Esempio n. 1
0
def get_all_assignments():
    # Grab a list of all completed assignments with turkid
    # Grab a list of all the already-sent turkid tokens
    # For each assignment, if it's not in the turkid list:
    #   then send them a worker notification including the url
    #   update the redis so that we know they're available
    for hitid in get_all_hitids():
        results_xml = request('GetAssignmentsForHIT',
                          HITId=hitid,
                          AssignmentStatus='Submitted',
                          PageSize=100)
        assignments = results_xml.getElementsByTagName('Assignment')
        for ass in assignments:
            # TODO Check that the assignment is legit?
            workerid = ass.getElementsByTagName('WorkerId')[0].childNodes[0].data
            if not game.db.hexists('notified_workers', workerid):
                print 'workerid:', workerid, ' has not yet been notified'
                invite = game.add_invite()
                notify_worker(workerid, invite)
                game.db.hset('notified_workers', workerid, invite)
Esempio n. 2
0
 def admin_newuser():
     # Create a new random string
     userkey = game.add_invite()
     return flask.redirect('/' + userkey)