Skip to content

Commit

Permalink
toofasttripremover: Don't check unspecified stop times
Browse files Browse the repository at this point in the history
  • Loading branch information
jbruechert committed Jan 11, 2025
1 parent de72afd commit 185f930
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions processors/toofasttripremover.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ func (f TooFastTripRemover) Run(feed *gtfsparser.Feed) {
for i := 1; i < len(t.StopTimes); i++ {
dist += distSApprox(t.StopTimes[i-1].Stop(), t.StopTimes[i].Stop())

if t.StopTimes[i].Arrival_time().Empty() || last.Departure_time().Empty() {
continue
}

inter := t.StopTimes[i].Arrival_time().SecondsSinceMidnight() - last.Departure_time().SecondsSinceMidnight()


speed := 0.0

if inter == 0 {
Expand Down Expand Up @@ -104,6 +109,10 @@ func (f TooFastTripRemover) Run(feed *gtfsparser.Feed) {
for i := j + 1; i < len(t.StopTimes); i++ {
dist += distSApprox(t.StopTimes[i-1].Stop(), t.StopTimes[i].Stop())

if t.StopTimes[i].Arrival_time().Empty() || t.StopTimes[j].Departure_time().Empty() {
continue
}

inter := t.StopTimes[i].Arrival_time().SecondsSinceMidnight() - t.StopTimes[j].Departure_time().SecondsSinceMidnight()

speed := 0.0
Expand Down

0 comments on commit 185f930

Please sign in to comment.