Skip to content

Commit

Permalink
Fixed bug in getting earlyBellTime in Gantt.
Browse files Browse the repository at this point in the history
Changed GeoAnimation to set xMax, yMax to 1 when there are no points in the gpx file to prevent divide by zero.
  • Loading branch information
esitarski committed Jul 17, 2024
1 parent 1d6fd05 commit 36491c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Gantt.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,10 @@ def refresh( self ):
earlyBellTimes.extend( c.earlyBellTime if r.status == Finisher else None for r in catResults )
else:
results = GetResults( category )
earlyBellTimes = [(category.earlyBellTime if category else None) if r.status == Finisher else None for r in results]
def _getEarlyBellTime( num ):
c = race.getCategory( num )
return c.earlyBellTime if c else None
earlyBellTimes = [_getEarlyBellTime(r.num) if r.status == Finisher else None for r in results]

if race.showFullNamesInChart:
def getLabel( r ):
Expand Down
5 changes: 3 additions & 2 deletions GeoAnimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,9 @@ def setPoints( self, gpsPoints, isPointToPoint = False ):
self.gpsPoints = gpsPoints
self.isPointToPoint = isPointToPoint

self.xMax = max( (p.x for p in self.gpsPoints), default=0 )
self.yMax = max( (p.y for p in self.gpsPoints), default=0 )
# Default max to 1 to avoid divisivion by zero errors.
self.xMax = max( (p.x for p in self.gpsPoints), default=1 )
self.yMax = max( (p.y for p in self.gpsPoints), default=1 )

dCum = 0.0
self.cumDistance = []
Expand Down

0 comments on commit 36491c8

Please sign in to comment.