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

[feature] #NAV-3079 - Ntfs2gtfs - Add ticketing_deep_links to gtfs export #951

Merged
merged 6 commits into from
Jul 4, 2024

Conversation

ArnaudOggy
Copy link
Contributor

No description provided.

@ArnaudOggy ArnaudOggy force-pushed the NAV-3079_gtfs2ntfs_support_gtfs_deeplinks branch from 83e5731 to 6334e05 Compare July 3, 2024 13:55
Copy link
Contributor

@woshilapin woshilapin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋

id: format!("ticketing_deep_link:{}", i + 1),
web_url: Some(fare_url.clone()),
android_intent_uri: Some(fare_url.clone()),
ios_universal_link_url: Some(fare_url.clone()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last one probably don't need a .clone() 🤷

src/gtfs/write.rs Outdated Show resolved Hide resolved
Co-authored-by: Jean SIMARD <[email protected]>
.get(fare_url)
.map(|ticketing_deep_link| ticketing_deep_link.id.clone())
})
.or_else(|| Some(String::new()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to have an empty String here ?
If I understand agency.ticketing_deep_link_id may have 3 outputs

  1. Some("a_string_not_empty") if ticketing_deep_links IS NOT empty and ticketing_deep_links.get(fare_url) exists
  2. Some("") if ticketing_deep_links IS NOT empty and ticketing_deep_links.get(fare_url) DOES NOT exist
  3. None if ticketing_deep_links IS empty

I think if you have something like

agency.ticketing_deep_link_id = network
    .fare_url
    .as_ref()
    .and_then(|fare_url| {
        ticketing_deep_links
        .get(fare_url)
        .map(|ticketing_deep_link| ticketing_deep_link.id.clone())
    });
}

It will return Some("something") or None and None will be serialized to ""

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added comments on the reason for this empty string 81a9cf1

@ArnaudOggy ArnaudOggy requested a review from datanel July 4, 2024 09:25
@ArnaudOggy ArnaudOggy merged commit 04142c0 into master Jul 4, 2024
13 checks passed
@ArnaudOggy ArnaudOggy deleted the NAV-3079_gtfs2ntfs_support_gtfs_deeplinks branch July 4, 2024 13:26
@ArnaudOggy ArnaudOggy changed the title #NAV-3079 - Ntfs2gtfs - Add ticketing_deep_links to gtfs export [feature] #NAV-3079 - Ntfs2gtfs - Add ticketing_deep_links to gtfs export Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants