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

Adds shortcut button to add exam evaluation #2050

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

FSadrieh
Copy link
Collaborator

@FSadrieh FSadrieh commented Oct 23, 2023

@richardebeling richardebeling marked this pull request as draft October 23, 2023 18:30
@FSadrieh FSadrieh marked this pull request as ready for review November 20, 2023 18:08
evap/staff/templates/staff_semester_view.html Outdated Show resolved Hide resolved
evap/staff/urls.py Outdated Show resolved Hide resolved
evap/staff/views.py Outdated Show resolved Hide resolved
evap/staff/views.py Outdated Show resolved Hide resolved
@janno42 janno42 linked an issue Nov 27, 2023 that may be closed by this pull request
evap/staff/templates/staff_semester_view_evaluation.html Outdated Show resolved Hide resolved
evap/staff/views.py Outdated Show resolved Hide resolved
evap/staff/views.py Outdated Show resolved Hide resolved
evap/staff/views.py Outdated Show resolved Hide resolved
evap/staff/views.py Outdated Show resolved Hide resolved
Copy link
Member

@niklasmohrin niklasmohrin 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 from a quick skim 👍 I will take a closer look once the modals are done and in use here

evap/staff/views.py Outdated Show resolved Hide resolved
@richardebeling
Copy link
Member

@FSadrieh Modals are merged so you should be un-blocked here now

evap/settings.py Outdated Show resolved Hide resolved
evap/staff/templates/staff_semester_view.html Outdated Show resolved Hide resolved
evap/staff/templates/staff_semester_view_evaluation.html Outdated Show resolved Hide resolved
evap/staff/templates/staff_semester_view_evaluation.html Outdated Show resolved Hide resolved
Copy link
Member

@janno42 janno42 left a 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

evap/staff/templates/staff_semester_view_evaluation.html Outdated Show resolved Hide resolved
evap/staff/views.py Outdated Show resolved Hide resolved
evap/staff/views.py Outdated Show resolved Hide resolved
@Kakadus Kakadus self-requested a review April 29, 2024 18:01
evap/staff/templates/staff_semester_view_evaluation.html Outdated Show resolved Hide resolved
evap/staff/templates/staff_semester_view_evaluation.html Outdated Show resolved Hide resolved
deployment/localsettings.template.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@Kakadus Kakadus left a 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/tests/test_views.py Outdated Show resolved Hide resolved
evap/staff/tests/test_views.py Outdated Show resolved Hide resolved
evap/staff/tests/test_views.py Outdated Show resolved Hide resolved
evap/staff/tests/test_views.py Outdated Show resolved Hide resolved
evap/staff/tests/test_views.py Show resolved Hide resolved
evap/staff/views.py Outdated Show resolved Hide resolved
evap/staff/views.py Outdated Show resolved Hide resolved
evap/staff/views.py Show resolved Hide resolved
evap/staff/views.py Outdated Show resolved Hide resolved
evap/staff/views.py Outdated Show resolved Hide resolved
evap/staff/views.py Outdated Show resolved Hide resolved
Comment on lines 1071 to 1075
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()
Copy link
Member

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)

Copy link
Collaborator Author

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?

evap/evaluation/models.py Outdated Show resolved Hide resolved
evap/evaluation/models.py Outdated Show resolved Hide resolved
evap/evaluation/models.py Outdated Show resolved Hide resolved
evap/evaluation/models.py Outdated Show resolved Hide resolved
evap/staff/views.py Outdated Show resolved Hide resolved
Copy link
Member

@niklasmohrin niklasmohrin left a 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 👍

Comment on lines +380 to +381
{% for evaluation in evaluations %}
<form id="exam_creation_form_{{ evaluation.id }}" reload-on-success method="post" action="{% url 'staff:create_exam_evaluation' %}">
Copy link
Member

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

evap/staff/templates/staff_semester_view_evaluation.html Outdated Show resolved Hide resolved
Comment on lines 191 to 192
{% 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 }}">
Copy link
Member

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

Copy link
Collaborator Author

@FSadrieh FSadrieh Jul 1, 2024

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.

evap/staff/templates/staff_semester_view_evaluation.html Outdated Show resolved Hide resolved
evap/staff/templates/staff_semester_view_evaluation.html Outdated Show resolved Hide resolved
</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 }}">
Copy link
Member

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 :)

evap/evaluation/models.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Shortcut button for creating exam evaluation
5 participants