-
Notifications
You must be signed in to change notification settings - Fork 146
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 shortcut button to add exam evaluation #2050
base: main
Are you sure you want to change the base?
Conversation
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.
Looks good from a quick skim 👍 I will take a closer look once the modals are done and in use here
@FSadrieh Modals are merged so you should be un-blocked here now |
6adf24a
to
6597968
Compare
… and teeeeeeeeeeeeeeeeeeeeeeeeeests
635006f
to
b1e3957
Compare
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.
not tested yet, will submit another review
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.
looking good 👍
evap/staff/views.py
Outdated
if evaluation.vote_start_datetime > evaluation_end_date: | ||
messages.error( | ||
request, _("The exam date is before the start date of the main evaluation. No exam evaluation was created.") | ||
) | ||
return HttpResponse() |
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 don't think the message flow makes sense here (as is reflected in the test for this): The post request will be answered with an empty HTTP 200 OK -- how would a user get that error? To my understanding, they would only see that once they go to a new page, right?
If this error is possible to be triggered by a user, they should get a meaningful error immediately.
(A post-only REST handler setting an error in the messages framework generall seems not really useful to me)
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.
@niklasmohrin we settled to check the date when the user submits the modal, similar to the semester deletion modal (See the new commit). One problem we currently face is the error message disappearing fast as the modal closes on click. How would this feature work best with the confirmation modal?
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.
some comments before I take a closer look at the view code; confirmation modal usage is mostly correct, only some subtleties 👍
{% for evaluation in evaluations %} | ||
<form id="exam_creation_form_{{ evaluation.id }}" reload-on-success method="post" action="{% url 'staff:create_exam_evaluation' %}"> |
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.
Given that except for the id
, all these forms are equal, we really only need one
{% if not evaluation.has_exam %} | ||
<confirmation-modal type="submit" id="exam_creation_modal" name="evaluation_id" value="{{ evaluation.id }}" confirm-button-class="btn-primary" form="exam_creation_form_{{ evaluation.id }}"> |
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.
The id
of these modals will be duplicated when there is more than one applicable evaluation - I think we don't need the id anyways, in that case let's just remove it
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 do not think we can remove it. Without id it throws: ValueError: "<Evaluation: Database Systems I – Exam>" needs to have a value for field "id" before this many-to-many relationship can be used.
</span> | ||
<span slot="extra-inputs"> | ||
<label for="exam_date">{% translate 'Exam Date:' %}</label> | ||
<input type="date" id="exam_date" name="exam_date" required form="exam_creation_form_{{ evaluation.id }}"> |
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 id will also be duplicated. We could include the evaluation's id, or it should also work to move the input
element into the label
element, then we don't need the id
and for
attributes (see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label). I think I prefer the second approach, we would have to make sure it also works with type="date"
though :)
#2008