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

Institutions LEI Bug #49

Merged
merged 2 commits into from
Nov 7, 2023
Merged

Institutions LEI Bug #49

merged 2 commits into from
Nov 7, 2023

Conversation

guffee23
Copy link
Contributor

@guffee23 guffee23 commented Nov 2, 2023

Closes #46

Added a check for when no institutions are present.
Added corresponding test.
Copy link

github-actions bot commented Nov 2, 2023

Coverage report

The coverage rate went from 84.93% to 84.93% ⬇️
The branch rate is 85%.

100% of new lines are covered.

Diff Coverage details (click to unfold)

src/entities/repos/institutions_repo.py

100% of new lines are covered (96.82% of the complete file).

@@ -53,6 +53,8 @@ async def create_institution(
async def get_associated_institutions(request: Request):
user: AuthenticatedUser = request.user
email_domain = get_email_domain(user.email)
if not user.institutions:
return []
associated_institutions = await repo.get_institutions(request.state.db_session, user.institutions)
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's also add the safe guard in the repo, so empty list of leis doesn't return everything

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The search by list of leis was added functionality to this endpoint. It would send all institutions back if nothing was specified (domain, pg #, count). For clarification, we want to remove this feature to be lei specific search?

Copy link
Collaborator

Choose a reason for hiding this comment

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

no, this stays as is, but the repo should have a safe guard as well; right now the repo treats both None and empty list as the same, which shouldn't be the case.

Copy link
Collaborator

Choose a reason for hiding this comment

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

second thought, just have the logic in the repo is good enough, so the router doesn't need to have this check.

Copy link
Collaborator

@lchen-2101 lchen-2101 left a comment

Choose a reason for hiding this comment

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

LGTM

@lchen-2101 lchen-2101 merged commit feb4c50 into main Nov 7, 2023
3 checks passed
@lchen-2101 lchen-2101 deleted the 46_institutions_repo_query_bug branch November 7, 2023 18:11
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.

Bug: institutions repo query for institutions retrieving all institutions if leis provided is empty list
3 participants