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

Support anonymous users in question finder #634

Merged
merged 4 commits into from
Aug 23, 2024

Conversation

jsharkey13
Copy link
Member

This PR is mostly to add support for anonymous users in question finder augmentation and filtering behaviour.

There are some performance optimisations (don't load the user multiple times, avoid filtering if the filter is equivalent "everything"), and one key behavior change (don't augment results if statuses is not specified, which restores the old behaviour useful for the gameboard builder).

Sadly this isUserStaff also throws, on a null value. This can't happen
given the if statement, but Java isn't that clever.
However, do not augment results if question statuses are not specified.
This makes it possible to use this endpoint for gameboard building
without the overhead of loading question attempts.
Copy link

codecov bot commented Aug 23, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 12 lines in your changes missing coverage. Please review.

Project coverage is 34.38%. Comparing base (ff38e9b) to head (4cd9e23).
Report is 5 commits behind head on master.

Files Patch % Lines
...n/java/uk/ac/cam/cl/dtg/isaac/api/PagesFacade.java 28.57% 5 Missing and 5 partials ⚠️
.../cl/dtg/isaac/api/managers/UserAttemptManager.java 71.42% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #634      +/-   ##
==========================================
- Coverage   34.40%   34.38%   -0.03%     
==========================================
  Files         514      514              
  Lines       23101    23109       +8     
  Branches     2792     2795       +3     
==========================================
- Hits         7948     7946       -2     
- Misses      14355    14361       +6     
- Partials      798      802       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@mlt47 mlt47 left a comment

Choose a reason for hiding this comment

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

Looks good.
For your Enum question I'd go with a static method that returns the set.

src/main/java/uk/ac/cam/cl/dtg/isaac/api/PagesFacade.java Outdated Show resolved Hide resolved
src/main/java/uk/ac/cam/cl/dtg/isaac/api/Constants.java Outdated Show resolved Hide resolved
src/main/java/uk/ac/cam/cl/dtg/isaac/api/Constants.java Outdated Show resolved Hide resolved
It was neat, but it did make the code much less clear!
Having the static attribute is more efficient than recomputing it each
time the method is called, though.
@mlt47 mlt47 merged commit b597bfb into master Aug 23, 2024
3 checks passed
@mlt47 mlt47 deleted the feature/QF-anon-user-functionality branch August 23, 2024 15:19
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.

2 participants