Skip to content

Commit

Permalink
Merge pull request #1316 from transitland/fix-resolved-onestop-id
Browse files Browse the repository at this point in the history
properly output `resolved_onestop_id` when available from tlv2
  • Loading branch information
drewda authored Feb 18, 2022
2 parents d27c504 + 6bf8291 commit 21c1ba9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/serializers/operator_in_feed_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ class OperatorInFeedSerializer < ApplicationSerializer
:feed_onestop_id,
:operator_url,
:feed_url

def gtfs_agency_id
object.gtfs_agency_id || object.try(:resolved_gtfs_agency_id)
end


def operator_onestop_id
object.operator.try(:onestop_id) || object.try(:resolved_onestop_id)
Expand All @@ -37,7 +42,7 @@ def operator_url
if object.operator.try(:persisted?)
api_v1_operator_url(object.operator.onestop_id)
elsif object.try(:resolved_onestop_id).present?
"https://transit.land/api/v2/rest/operators/${resolved_onestop_id}"
"https://transit.land/api/v2/rest/operators/#{object.try(:resolved_onestop_id)}"
end
end

Expand Down

0 comments on commit 21c1ba9

Please sign in to comment.