Exemple #1
0
def format_flight_title(flight):
    title = format_distance(flight.olc_classic_distance)
    title = title + ' on ' + format_date(flight.takeoff_time)

    tagline = ''
    if flight.pilot:
        tagline = tagline + ' by ' + unicode(flight.pilot)

    if flight.co_pilot:
        tagline = tagline + ' and ' + unicode(flight.co_pilot)

    return title, tagline
Exemple #2
0
def format_phase(phase):
    """Format phase properties to human readable format
    """
    is_circling = phase.phase_type == FlightPhase.PT_CIRCLING
    r = dict(start="%s" % format_time(phase.start_time),
             fraction="%d%%" % phase.fraction if phase.fraction else "",
             speed=units.format_speed(float(phase.speed)) if phase.speed else "",
             vario=units.format_lift(phase.vario),
             alt_diff=units.format_altitude(phase.alt_diff),
             count=phase.count,
             duration=phase.duration,
             is_circling=is_circling,
             type=PHASETYPE_NAMES[phase.phase_type],
             circling_direction="",
             distance="",
             glide_rate="")

    if not is_circling:
        r['distance'] = units.format_distance(phase.distance)
        r['glide_rate'] = format_number(phase.glide_rate)
    else:
        r['circling_direction'] = CIRCDIR_NAMES[phase.circling_direction]
    return r