Skip to content

Commit

Permalink
calculate the real ly value
Browse files Browse the repository at this point in the history
  • Loading branch information
bgol committed Dec 22, 2014
1 parent 096fb22 commit 3122bc9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions commands/nav_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ def run(results, cmdenv, tdb):
maxLy=maxLyPer,
)

lastHop, totalLy, dirLy = None, 0.00, 0.00
totalLy, dirLy = 0.00, 0.00
route.reverse()
for hop in route:
jumpLy = (distances[hop][0] - distances[lastHop][0]) if lastHop else 0.00
totalLy += jumpLy
jumpLy = math.sqrt(hop.distToSq(distances[hop][1])) if distances[hop][1] else 0.00
if cmdenv.detail:
totalLy = math.sqrt(srcSystem.distToSq(hop))
dirLy = math.sqrt(dstSystem.distToSq(hop))
row = ResultRow(
action='Via',
Expand All @@ -155,7 +155,6 @@ def run(results, cmdenv, tdb):
dirLy=dirLy,
)
results.rows.append(row)
lastHop = hop
results.rows[0].action='Depart'
results.rows[-1].action='Arrive'

Expand Down Expand Up @@ -183,7 +182,7 @@ def render(results, cmdenv, tdb):
rowFmt.addColumn("JumpLy", '>', '7', '.2f',
key=lambda row: row.jumpLy)
if cmdenv.detail:
rowFmt.addColumn("Stations", '>', 2,
rowFmt.addColumn("Stations", '>', 2,
key=lambda row: len(row.system.stations))
if cmdenv.detail:
rowFmt.addColumn("DistLy", '>', '7', '.2f',
Expand Down

0 comments on commit 3122bc9

Please sign in to comment.