Skip to content

Commit

Permalink
fix(editor): fix avg speed travel time calculation for pattern stops
Browse files Browse the repository at this point in the history
  • Loading branch information
landonreed committed Feb 5, 2018
1 parent 1a2ffd0 commit 55a9ff5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/editor/components/pattern/CalculateDefaultTimesForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ export default class CalculateDefaultTimesForm extends Component {
const convertedSpeed = speed * 1000 / 60 / 60 // km/hr -> m/s
for (var i = 0; i < patternStops.length; i++) {
patternStops[i].defaultDwellTime = dwellTime
patternStops[i].defaultTravelTime = patternStops[i].shapeDistTraveled / convertedSpeed
if (i > 0) {
const distanceTraveled = patternStops[i].shapeDistTraveled - patternStops[i - 1].shapeDistTraveled
patternStops[i].defaultTravelTime = distanceTraveled / convertedSpeed
}
}
updateActiveEntity(activePattern, 'trippattern', {patternStops})
saveActiveEntity('trippattern')
Expand Down

0 comments on commit 55a9ff5

Please sign in to comment.