-
Notifications
You must be signed in to change notification settings - Fork 5
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
Adds warning when setting same quiz to class multiple times #1071
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1071 +/- ##
==========================================
- Coverage 36.88% 36.83% -0.06%
==========================================
Files 426 426
Lines 18803 18872 +69
Branches 5568 5582 +14
==========================================
+ Hits 6936 6952 +16
- Misses 11828 11881 +53
Partials 39 39 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works and the implementation is along the right lines.
However, I believe that the RTK Query hook is actually doing what you want from it by default, so we should be able to simplify the implementation by switch to just using it! :)
@@ -46,6 +47,8 @@ interface QuizSettingModalProps { | |||
feedbackMode?: QuizFeedbackMode | null; | |||
} | |||
|
|||
let allQuizAssignments: QuizAssignmentDTO[] | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we have this information (perhaps retrieved in a different way given other comments) it might be useful to alter groupOptions
to add " (already assigned)" to the group label in the drop-down so that the user gets a warning even earlier. It is possible that this will look overcrowded in which case there might be an alternative solution that is nicer - I don't know if the component supports disabled options, for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good call, and also that it works best with items being disabled in the StyledSelect
.
I initially had some issues with disabled items still being focused by default (annoyingly React has been working on a solution to this for a while), but the change to options
in styles
solves that in the scope of this page, so I'm pretty happy with it all now.
Previously on re-submitting an active test, a toast would display a back-end warning "You cannot reassign a test until the due date has passed."
This change makes it fail earlier (on the front-end), displaying red warning text below the "...group(s)" input and disabling the "Set Test" button.
I am making use of a top-level
let
as a workaround to stop polling the back-end on every change to the Set Tests modal (while avoiding dreaded React hook nonsense - otherwiseuseEffect
would be lovely here). Since the value only changes on successfully setting a test, it does not need a re-render so this should be fine - however I'm very open to suggestions for another solution.