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

Refactor enrollment check to lookup groups for funding source #2068

Open
2 tasks done
thekaveman opened this issue May 1, 2024 · 1 comment
Open
2 tasks done

Refactor enrollment check to lookup groups for funding source #2068

thekaveman opened this issue May 1, 2024 · 1 comment
Labels
back-end Django views, sessions, middleware, models, migrations etc.

Comments

@thekaveman
Copy link
Member

thekaveman commented May 1, 2024

When we first implemented enrollment expiration logic in #1989, the only way to check if the user (funding source) was already linked to a group was to look up all funding sources linked to the group, and check if the user's funding source was in the that list. Over time with increasing enrollments, this won't scale as every single funding source will have to be checked each time.

Now Littlepay offers an endpoint to look up the groups linked to a given funding source, i.e. the inverse relationship. See cal-itp/littlepay#60.

This will be a much shorter list to check -- empty for new users (funding sources), and perhaps one or two and not many more for existing users.

Acceptance Criteria

During enrollment:

  • Instead of looking up funding sources for the group, look up groups for the funding source
  • The user is considered already enrolled if the current eligibility's group is in the list

Additional context

Depends on cal-itp/littlepay#60.

This will be a refactor of the the work that comes back (but may be modified) with #2062.

@thekaveman thekaveman added the back-end Django views, sessions, middleware, models, migrations etc. label May 1, 2024
@thekaveman thekaveman changed the title Refactor current enrollment check to check groups for funding source Refactor enrollment check to lookup groups for funding source May 1, 2024
@angela-tran angela-tran self-assigned this Jun 17, 2024
@angela-tran
Copy link
Member

I tested out calling the endpoint implemented in cal-itp/littlepay#60 against the MST QA and prod Littlepay environments.

The endpoint returns a 404 status even though I'm giving it a funding source ID that I know is in a group (I can see it when I look up the funding sources for the group).

The response contains this JSON:

{'errors': [{'detail': 'Not found'}]}

@angela-tran angela-tran removed their assignment Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-end Django views, sessions, middleware, models, migrations etc.
Projects
Status: Paused
Development

Successfully merging a pull request may close this issue.

2 participants