Skip to content

Commit

Permalink
controllers.flights: better glide rate formatting
Browse files Browse the repository at this point in the history
Infinite or overly large glide rates are displayed as infinity symbol.
  • Loading branch information
kedder committed Sep 4, 2012
1 parent 25196f5 commit 1e4e620
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion skylines/controllers/flights.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,13 @@ def format_phase(phase):

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

# Sensible glide rate values are formatted as numbers. Others are shown
# as infinity symbol.
if abs(phase.alt_diff) > 0 and abs(phase.glide_rate) < 1000:
r['glide_rate'] = format_number(phase.glide_rate)
else:
r['glide_rate'] = u'\u221e' # infinity
else:
r['circling_direction'] = CIRCDIR_NAMES[phase.circling_direction]
return r
Expand Down

0 comments on commit 1e4e620

Please sign in to comment.