Exemplo n.º 1
0
def load_mapping_config(user):
    # Configure id and name of the apps.
    if is_admin(user):
        SchedulerState.reset_mappings()
        mappings = g.data.get('mappings', [])
        SchedulerState.set_cols(len(mappings[0]))
        SchedulerState.set_rows(len(mappings))
        for row in range(len(mappings)):
            for col in range(len(mappings[row])):
                SchedulerState.set_mappings(row, col, mappings[row][col])
        return jsonify(success=True)
    else:
        return jsonify(success=False)
Exemplo n.º 2
0
def set_building_dimensions(user):
    if not is_admin(user):
        abort(403, "Forbidden Bru")

    body = request.get_json()
    if 'height' not in body:
        abort(415, 'Missing height value')
    if 'width' not in body:
        abort(415, 'Missing width value')

    SchedulerState.set_rows(body['height'])
    SchedulerState.set_cols(body['width'])
    return jsonify(width=SchedulerState.get_rows(),
                  height=SchedulerState.get_cols())