示例#1
0
def update_group_station_state(group, station):
    """
    Required by the android client.
    """
    group = unquote_plus(group)
    station = unquote_plus(station)
    try:
        form_score = request.json['form_score']
        station_score = request.json['score']
        station_state = request.json['state']
    except LookupError:
        return jsonify({'message': 'Missing value'}), 400

    loco.set_score(mdl.DB.session, group, station, station_score, form_score,
                   station_state)

    station_entity = mdl.Station.one(name=station)
    group_entity = mdl.Group.one(name=group)

    return jsonify(
        group_name=group,
        form_score=form_score,
        score=station_score,
        state=station_state,
        station_name=station,
        station_id=station_entity.id,
        group_id=group_entity.id)
示例#2
0
def set_group_score(group_id, station_id):
    try:
        form_score = request.json['form']
        station_score = request.json['station']
    except LookupError:
        return jsonify({'message': 'Missing value'}), 400
    loco.set_score(g.session, group_id, station_id, station_score, form_score)
    return jsonify({
        'form_score': form_score,
        'station_score': station_score
    })
示例#3
0
def update_group_station_state(group, station):
    group = unquote_plus(group)
    station = unquote_plus(station)
    try:
        form_score = request.json['form']
        station_score = request.json['station']
        station_state = request.json['state']
    except LookupError:
        return jsonify({'message': 'Missing value'}), 400

    loco.set_score(g.session, group, station, station_score, form_score,
                   station_state)

    return jsonify(
        name=group,
        form_score=form_score,
        score=station_score,
        state=station_state,
        station_name=station)