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

Begin fixing issue where empty string agency ID might not match coif #195

Open
wants to merge 1 commit into
base: main
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
10 changes: 5 additions & 5 deletions dmfr/sync/oifs.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

type oifmatch struct {
feedID int
resolvedGtfsAgencyID string
resolvedGtfsAgencyID tl.String
}

type agencyOnestop struct {
Expand Down Expand Up @@ -76,7 +76,7 @@ func updateOifs(atx tldb.Adapter, operator tl.Operator) (bool, error) {
return false, err
}
for _, oif := range oifexisting {
oiflookup[oifmatch{feedID: oif.FeedID, resolvedGtfsAgencyID: oif.ResolvedGtfsAgencyID.String}] = oif.ID
oiflookup[oifmatch{feedID: oif.FeedID, resolvedGtfsAgencyID: oif.ResolvedGtfsAgencyID}] = oif.ID
}
for _, oif := range operator.AssociatedFeeds {
// Get feed id
Expand Down Expand Up @@ -110,7 +110,7 @@ func updateOifs(atx tldb.Adapter, operator tl.Operator) (bool, error) {
}
}
// Match or insert
check := oifmatch{feedID: oif.FeedID, resolvedGtfsAgencyID: oif.ResolvedGtfsAgencyID.String}
check := oifmatch{feedID: oif.FeedID, resolvedGtfsAgencyID: oif.ResolvedGtfsAgencyID}
if match, ok := oiflookup[check]; ok {
oifmatches[match] = true
} else {
Expand Down Expand Up @@ -151,7 +151,7 @@ func feedUpdateOifs(atx tldb.Adapter, feed tl.Feed) (bool, error) {
return false, err
}
for _, oif := range oifexisting {
oiflookup[oifmatch{feedID: oif.FeedID, resolvedGtfsAgencyID: oif.ResolvedGtfsAgencyID.String}] = oif.ID
oiflookup[oifmatch{feedID: oif.FeedID, resolvedGtfsAgencyID: oif.ResolvedGtfsAgencyID}] = oif.ID
if oif.OperatorID.Valid {
oifmatches[oif.ID] = true // allow matching on operator associated oifs, but do not delete them
}
Expand All @@ -172,7 +172,7 @@ func feedUpdateOifs(atx tldb.Adapter, feed tl.Feed) (bool, error) {
return false, err
}
for _, agency := range agencies {
check := oifmatch{feedID: feedid, resolvedGtfsAgencyID: agency.AgencyID}
check := oifmatch{feedID: feedid, resolvedGtfsAgencyID: tl.NewString(agency.AgencyID)}
if match, ok := oiflookup[check]; ok {
oifmatches[match] = true
} else {
Expand Down