Skip to content

Commit

Permalink
display launch withount radius in task results if launch is not check…
Browse files Browse the repository at this point in the history
…ed as turnpoint.
  • Loading branch information
biuti committed May 23, 2021
1 parent 0e51bc0 commit dba397c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion airscore/core/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,8 @@ def pretty_format_results(content, timeoffset=0, td=0, cd=0):
if key == 'radius':
'''formatting wpt radius'''
formatted[key] = (
f"{round(float(value) / 1000, 1):.1f} Km"
'' if float(value) == 0
else f"{round(float(value) / 1000, 1):.1f} Km"
if float(value) > 1000
else f"{round(float(value))} m  "
)
Expand Down
3 changes: 3 additions & 0 deletions airscore/core/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,9 @@ def create_json_elements(self):
for idx, tp in enumerate(self.turnpoints):
wpt = {x: getattr(tp, x) for x in TaskResult.route_list if x in dir(tp)}
wpt['cumulative_dist'] = self.partial_distance[idx]
'''launch radius to 0 if check_luanch is off'''
if self.check_launch == 'off' and tp.type == 'launch':
wpt['radius'] = 0
route.append(wpt)
results = []
for pil in pil_list:
Expand Down

0 comments on commit dba397c

Please sign in to comment.