def POST(self, worker_id): #First check that the user has not already made a prediction for this game data = web.input() game_id = data["game_id"] check = model.check_for_existing_prediction_entered(worker_id, game_id) if check > 0: raise web.seeother('/error/6?worker_id=' + worker_id) model.add_prediction(worker_id, data) next_game = model.get_games_played(worker_id) + 1 raise web.seeother('/play/' + worker_id + "/" + str(next_game))
def GET(self): worker_id = web.input(worker_id='').worker_id stage = model.get_current_stage(worker_id) stages = { 1:"/instructions/", 2:"/play/", 3:"/survey/", 4:"/claim_code/" } if stage == 2: next_game = model.get_games_played(worker_id) + 1 raise web.seeother('/play/' + worker_id + '/' + str(next_game)) else: raise web.seeother(stages[stage] + worker_id)