Exemple #1
0
def socket_previous_assignments(message):
    rendering = Rendering.objects.get(id=message['rendering_id'])
    assignments = [a.to_dict() for a in Assignment.objects(rendering=rendering, status=Assignment.DONE)]

    emit('previous assignments', dict(assignments=assignments))

    return jsonify(ok=True)
Exemple #2
0
def on_leave():
    f = open('loglog', 'a+')
    f.write('--\nin disconnect')
    load_request_user()
    for assignment in Assignment.objects(assigned_to=g.user, status=Assignment.ASSIGNED):
        assignment.status = Assignment.UNASSIGNED
        assignment.assigned_to = None
        f.write('Cancelled one assignment\n')
Exemple #3
0
def socket_get_rendering(message):
    available_renderings = [r for r in Rendering.objects().order_by('-date_created')
                            if any(a.status == Assignment.UNASSIGNED for a in Assignment.objects(rendering=r))]
    if available_renderings:
        rendering_dict = available_renderings[0].to_dict()
        # rendering_dict['completion'] = rendering.completion
        emit('new rendering', dict(ok=True, result=rendering_dict))
    else:
        return emit('new rendering', dict(ok=False))