Esempio n. 1
0
def _pull_user_id(endpoint, values):
    g.user_id = values.pop('user_id')

    g.pilots = get_requested_record_list(
        User, g.user_id, joinedload=[User.club])

    color_gen = color.generator()
    for pilot in g.pilots:
        pilot.color = color_gen.next()
Esempio n. 2
0
def _pull_user_id(endpoint, values):
    g.user_id = values.pop('user_id')

    g.pilots = get_requested_record_list(User,
                                         g.user_id,
                                         joinedload=[User.club])

    color_gen = color.generator()
    for pilot in g.pilots:
        pilot.color = color_gen.next()
Esempio n. 3
0
def read(user_ids):
    pilots = get_requested_record_list(User, user_ids, joinedload=[User.club])

    color_gen = color.generator()
    for pilot in pilots:
        pilot.color = next(color_gen)

    traces = list(map(_get_flight_path, pilots))
    if not any(traces):
        traces = None

    user_schema = UserSchema()

    pilots_json = []
    for pilot in pilots:
        json = user_schema.dump(pilot).data
        json["color"] = pilot.color
        pilots_json.append(json)

    flights = []
    if traces:
        for pilot, trace in zip(pilots, traces):
            if trace:
                flights.append(
                    {
                        "sfid": pilot.id,
                        "points": trace["points"],
                        "barogram_t": trace["barogram_t"],
                        "barogram_h": trace["barogram_h"],
                        "enl": trace["enl"],
                        "contests": None,
                        "elevations_t": trace["barogram_t"],
                        "elevations_h": trace["elevations"],
                        "geoid": trace["geoid"],
                        "additional": {
                            "competition_id": pilot.tracking_callsign
                            or pilot.initials(),
                            "color": pilot.color,
                        },
                    }
                )

    return jsonify(flights=flights, pilots=pilots_json)
Esempio n. 4
0
def read(user_ids):
    pilots = get_requested_record_list(User, user_ids, joinedload=[User.club])

    color_gen = color.generator()
    for pilot in pilots:
        pilot.color = color_gen.next()

    traces = map(_get_flight_path, pilots)
    if not any(traces):
        traces = None

    user_schema = UserSchema()

    pilots_json = []
    for pilot in pilots:
        json = user_schema.dump(pilot).data
        json['color'] = pilot.color
        pilots_json.append(json)

    flights = []
    if traces:
        for pilot, trace in zip(pilots, traces):
            if trace:
                flights.append({
                    'sfid': pilot.id,
                    'points': trace['points'],
                    'barogram_t': trace['barogram_t'],
                    'barogram_h': trace['barogram_h'],
                    'enl': trace['enl'],
                    'contests': None,
                    'elevations_t': trace['barogram_t'],
                    'elevations_h': trace['elevations'],
                    'geoid': trace['geoid'],
                    'additional': {
                        'competition_id':
                        pilot.tracking_callsign or pilot.initials(),
                        'color':
                        pilot.color,
                    },
                })

    return jsonify(flights=flights, pilots=pilots_json)
Esempio n. 5
0
def read(user_ids):
    pilots = get_requested_record_list(User, user_ids, joinedload=[User.club])

    color_gen = color.generator()
    for pilot in pilots:
        pilot.color = next(color_gen)

    traces = list(map(_get_flight_path, pilots))
    if not any(traces):
        traces = None

    user_schema = UserSchema()

    pilots_json = []
    for pilot in pilots:
        json = user_schema.dump(pilot).data
        json["color"] = pilot.color
        pilots_json.append(json)

    flights = []
    if traces:
        for pilot, trace in zip(pilots, traces):
            if trace:
                flights.append({
                    "sfid": pilot.id,
                    "points": trace["points"],
                    "barogram_t": trace["barogram_t"],
                    "barogram_h": trace["barogram_h"],
                    "enl": trace["enl"],
                    "contests": None,
                    "elevations_t": trace["barogram_t"],
                    "elevations_h": trace["elevations"],
                    "geoid": trace["geoid"],
                    "additional": {
                        "competition_id":
                        pilot.tracking_callsign or pilot.initials(),
                        "color":
                        pilot.color,
                    },
                })

    return jsonify(flights=flights, pilots=pilots_json)
Esempio n. 6
0
def read(user_ids):
    pilots = get_requested_record_list(User, user_ids, joinedload=[User.club])

    color_gen = color.generator()
    for pilot in pilots:
        pilot.color = color_gen.next()

    traces = map(_get_flight_path, pilots)
    if not any(traces):
        traces = None

    user_schema = UserSchema()

    pilots_json = []
    for pilot in pilots:
        json = user_schema.dump(pilot).data
        json['color'] = pilot.color
        pilots_json.append(json)

    flights = []
    if traces:
        for pilot, trace in zip(pilots, traces):
            if trace:
                flights.append({
                    'sfid': pilot.id,
                    'points': trace['points'],
                    'barogram_t': trace['barogram_t'],
                    'barogram_h': trace['barogram_h'],
                    'enl': trace['enl'],
                    'contests': None,
                    'elevations_t': trace['barogram_t'],
                    'elevations_h': trace['elevations'],
                    'geoid': trace['geoid'],
                    'additional': {
                        'competition_id': pilot.tracking_callsign or pilot.initials(),
                        'color': pilot.color,
                    },
                })

    return jsonify(flights=flights, pilots=pilots_json)