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

feat: extend line filtering to support nfk #261

Merged
merged 13 commits into from
Mar 22, 2024
Merged

Conversation

jonasbrunvoll
Copy link
Contributor

@jonasbrunvoll jonasbrunvoll commented Mar 12, 2024

Closes https://github.com/AtB-AS/kundevendt/issues/17072

Background

Hanne found an issue with the line filter for NFK: https://github.com/AtB-AS/kundevendt/issues/17037#issuecomment-1963487733

The planner web filters lines by ID. For FRAM and AtB this works as line ID = line number (aka publicCode in Journey Planner API). Customers can therefore search by line number.

  {
    "id": "MOR:Line:100",
    "publicCode": "100"
  },
  {
    "id": "MOR:Line:101",
    "publicCode": "101"
  },

This is not the case for NFK. For example do line 1, 2 and 200 in Bodø have line ID 8001, 8002 and 8200. Also, some lines have the same line number, but different line IDs. For example:

 {
        "id": "NOR:Line:12_8371",
        "publicCode": "1"
  },
 {
        "id": "NOR:Line:12_8636",
        "publicCode": "1"
  },
 {
        "id": "NOR:Line:12_8001",
        "publicCode": "1"
  },

Illustrations

screenshots/video/figma Skjermbilde 2024-03-12 kl  15 57 54 Skjermbilde 2024-03-12 kl  15 58 06

Proposed solution

In the proposed solution, all lines are fetched at the initial render of the line-filter component. Then, when a valid line number is written in the line filter component, any corresponding line id is included to the line whitelist of the trip search.

Acceptance Criteria

  • Line filter works for all organizations (AtB, FRAM and NFK).
  • Specified filters should not disappear when refreshing the page.
  • Lines query should only be run initially and when refreshing the page. Otherwise, the lines should be fetched from cache.

Test input

Trip suggestions for testing.

  • AtB: From Rønningsbakken, Trondheim, to Nidarosdomen, Trondheim.
  • FRAM: From Molde, Molde, to Batnfjordsøra, Gjemnes.
  • NFK: From Bodø sentrum, Bodø, to Universitetet, Bodø.

Copy link

vercel bot commented Mar 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
planner-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 20, 2024 0:23am

@jonasbrunvoll jonasbrunvoll changed the title feat: updated line filter feat: extend line filtering to be usable for nfk Mar 12, 2024
@jonasbrunvoll jonasbrunvoll changed the title feat: extend line filtering to be usable for nfk feat: extend line filtering to support nfk Mar 12, 2024
@adriansberg
Copy link
Contributor

Let's have a huddle about this tomorrow, easier to point and explain various ideas instead of having several comments trying to convey the same information but resulting in potential misunderstandings.

I put together some of the thoughts in this commit, so we can have a look at that together: c24f555

@mikaelbr
Copy link
Collaborator

I think a very quick win would be to use https://www.downshift-js.com/use-multiple-selection here.

@jonasbrunvoll
Copy link
Contributor Author

jonasbrunvoll commented Mar 21, 2024

Expanding line filtering to use useMultipleSelection can perhaps be a separate task? This PR is getting pretty big already.

Copy link
Contributor

@adriansberg adriansberg left a comment

Choose a reason for hiding this comment

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

LGTM! Tested and works as expected, adding lines when they are entered and removing them when removed, after the debounce set to 750ms passes.

I reckon that this feature will be worked on to possibly implement the multiple selection that we talked about. Would be nice to have some tests for this then.

@jonasbrunvoll jonasbrunvoll merged commit 4bd12d0 into main Mar 22, 2024
5 of 6 checks passed
@jonasbrunvoll jonasbrunvoll deleted the jonas/line_filter_nfk branch March 22, 2024 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants