Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The NumStopTimes attribute is not updated correctly when trips are deleted #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 23 additions & 21 deletions feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,25 +89,25 @@ func NewPolygon(outer [][2]float64, inners [][][2]float64) Polygon {

// A ParseOptions object holds options for parsing a the feed
type ParseOptions struct {
UseDefValueOnError bool
DropErroneous bool
DryRun bool
CheckNullCoordinates bool
EmptyStringRepl string
ZipFix bool
ShowWarnings bool
DropShapes bool
KeepAddFlds bool
DateFilterStart gtfs.Date
DateFilterEnd gtfs.Date
PolygonFilter []Polygon
UseStandardRouteTypes bool
MOTFilter map[int16]bool
MOTFilterNeg map[int16]bool
AssumeCleanCsv bool
RemoveFillers bool
UseDefValueOnError bool
DropErroneous bool
DryRun bool
CheckNullCoordinates bool
EmptyStringRepl string
ZipFix bool
ShowWarnings bool
DropShapes bool
KeepAddFlds bool
DateFilterStart gtfs.Date
DateFilterEnd gtfs.Date
PolygonFilter []Polygon
UseStandardRouteTypes bool
MOTFilter map[int16]bool
MOTFilterNeg map[int16]bool
AssumeCleanCsv bool
RemoveFillers bool
UseGoogleSupportedRouteTypes bool
DropSingleStopTrips bool
DropSingleStopTrips bool
}

type ErrStats struct {
Expand Down Expand Up @@ -2050,13 +2050,13 @@ func polyContCheck(ax float64, ay float64, bx float64, by float64, cx float64, c
EPSILON := 0.00000001
if ay == by && ay == cy {
if !((bx <= ax && ax <= cx) ||
(cx <= ax && ax <= bx)) {
(cx <= ax && ax <= bx)) {
return 1
}
return 0
}
if math.Abs(ay-by) < EPSILON &&
math.Abs(ax-by) < EPSILON {
math.Abs(ax-by) < EPSILON {
return 0
}

Expand All @@ -2074,7 +2074,7 @@ func polyContCheck(ax float64, ay float64, bx float64, by float64, cx float64, c
}

d := (bx-ax)*(cy-ay) -
(by-ay)*(cx-ax)
(by-ay)*(cx-ax)

if d > 0 {
return -1
Expand Down Expand Up @@ -2156,6 +2156,8 @@ func (feed *Feed) DeleteFareAttribute(id string) {
}

func (feed *Feed) DeleteTrip(id string) {
feed.NumStopTimes -= len(feed.Trips[id].StopTimes)

delete(feed.Trips, id)

// delete additional fields from CSV
Expand Down