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

Http verbs #1837

Merged
merged 7 commits into from
Jan 16, 2023
Merged

Http verbs #1837

merged 7 commits into from
Jan 16, 2023

Conversation

florian-str
Copy link
Collaborator

It changes the HTTP-Endpoint for a semester activation.

Due to the nature of the confirmation modals, only the query directly effected was changed to a form.

@niklasmohrin niklasmohrin linked an issue Nov 28, 2022 that may be closed by this pull request
@niklasmohrin niklasmohrin marked this pull request as draft November 28, 2022 18:04
@niklasmohrin
Copy link
Member

If you want to try at home: The branch is not based on the current version of our main branch, likely because you were on your previous feature branch when starting to work on this next feature. You can re-base your new commits by updating your local main branch to the newest version from us (git checkout main; git pull upstream main) and then running git rebase main after switching back to your feature branch (git checkout http_verbs).

... or we do it together at the next meeting :)

@florian-str florian-str marked this pull request as ready for review December 5, 2022 16:41
evap/rewards/tests/test_views.py Outdated Show resolved Hide resolved
evap/rewards/tests/test_views.py Outdated Show resolved Hide resolved
evap/rewards/urls.py Outdated Show resolved Hide resolved
evap/rewards/views.py Outdated Show resolved Hide resolved
evap/staff/templates/staff_semester_view.html Outdated Show resolved Hide resolved
Copy link
Member

@richardebeling richardebeling left a comment

Choose a reason for hiding this comment

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

Code looks very nice. I have some minor formatting and some project management / organizational annotations though.


return semester_view(request=request, semester_id=semester_id)
messages.get_messages(request).used = False
return redirect("staff:semester_view", semester_id) # semester_view(request=request, semester_id=semester_id)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return redirect("staff:semester_view", semester_id) # semester_view(request=request, semester_id=semester_id)
return redirect("staff:semester_view", semester_id)

SemesterActivation.objects.update_or_create(semester=semester, defaults={"is_active": active})
if active:
grant_eligible_reward_points_for_semester(request, semester)

return semester_view(request=request, semester_id=semester_id)
messages.get_messages(request).used = False
Copy link
Member

Choose a reason for hiding this comment

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

Is this necessary / what does it do? I think we've used redirects before and everything worked fine with messages.


{{ block.super }}
<form id="form_activation_status" method="post" action="{% url 'rewards:semester_activation_edit' semester.id%}">
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<form id="form_activation_status" method="post" action="{% url 'rewards:semester_activation_edit' semester.id%}">
<form id="form_activation_status" method="post" action="{% url 'rewards:semester_activation_edit' semester.id %}">


{{ block.super }}
<form id="form_activation_status" method="post" action="{% url 'rewards:semester_activation_edit' semester.id%}">
<input type="hidden" id="activation_status" name="activation_status" value="on"> {# FIXME #}
Copy link
Member

Choose a reason for hiding this comment

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

I'd oppose having a fixme without any comment here. I would be (hesitantly) okay with a reference to an issue (FIXME #123456). Overall, I'm just in favor of adding the issue and not adding the fixme. TODOs in code have a tendency to stay there.

@niklasmohrin what do you think? (Follow-up to #1837 (comment))

(repeated below in the javascript)

Copy link
Member

Choose a reason for hiding this comment

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

No strong opinion, we can make an issue if you want

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, final touches:

evap/rewards/tests/test_views.py Show resolved Hide resolved
evap/staff/templates/staff_semester_view.html 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.

Nice! Thanks :)

@richardebeling richardebeling merged commit 1cff7a4 into e-valuation:main Jan 16, 2023
@richardebeling
Copy link
Member

Thanks for submitting the PR :)

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.

Use proper HTTP verbs for reward semester activation
3 participants