Skip to content

Commit

Permalink
Feature: allow decision editing (#648)
Browse files Browse the repository at this point in the history
* fix: correct 'start of proposal' redirect for pre_approved

* fix: improve buttons on proposal_confirmation.html

* fix: diff bugfix

* fix: buttons on task and session delete

* fix: formatting

* Revert 'confirmation sent' text on button back to past tense

* Hotfix/to conclude review api view qs bug (#629)

* fix: add is_committee_review check to ToConcludeReviewApiView qs

* fix: add is_committee_review check to other API views

* formatting

---------

Co-authored-by: Ty Mees <[email protected]>

* feat: is_final_decision method on Decision model

* feat: Warning when submitting a final decision

* fix: A capital letter

* fix: Show decide review action when already decided

* feat: translations

* fix: Some fuzzy or missing translations

* feat: Turn final deicision warning into alert box

* fix: Same translation somehow needed fixing again...

* feat: Alternate action description for feedback editing

---------

Co-authored-by: Edo Storm <[email protected]>
Co-authored-by: Edo Storm <[email protected]>
Co-authored-by: Ty Mees <[email protected]>
  • Loading branch information
4 people authored Apr 3, 2024
1 parent ce67dc5 commit 4996f66
Show file tree
Hide file tree
Showing 11 changed files with 152 additions and 122 deletions.
219 changes: 110 additions & 109 deletions locale/en/LC_MESSAGES/django.po

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions main/templates/base/form_buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
{% if proposal.is_pre_assessment %}
<a class="button js-submit-redirect"
href="{% url 'proposals:update_pre' proposal.pk %}">{% trans "Terug naar begin aanvraag" %}</a>
{% elif proposal.is_pre_approved %}
<a class="button js-submit-redirect"
href="{% url 'proposals:update_pre_approved' proposal.pk %}">{% trans "Terug naar begin aanvraag" %}</a>
{% elif proposal.is_practice %}
<a class="button js-submit-redirect"
href="{% url 'proposals:update_practice' proposal.pk %}">
Expand Down
2 changes: 1 addition & 1 deletion proposals/templates/proposals/proposal_confirmation.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ <h2>{% trans "Bevestigingsbrief versturen" %}</h2>
<table>
{{ form.as_table }}
</table>
<a class="button" href="javascript:history.go(-1);">{% trans "Terug naar de vorige pagina" %}</a>
<input class="button"
type="submit"
value="{% trans 'Bevestigingsbrief verstuurd' %}" />
<a class="button" href="javascript:history.go(-1);">{% trans "Terug naar de vorige pagina" %}</a>
</form>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion proposals/utils/pdf_diff_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ def create_context_diff(context, old_proposal, new_proposal):
DiffSection(WMOSection(old_proposal.wmo), WMOSection(new_proposal.wmo))
)

if new_proposal.is_pre_assessment:
if not new_proposal.is_pre_assessment:
if (
new_proposal.wmo.status != new_proposal.wmo.WMOStatuses.NO_WMO
or old_proposal.wmo.status != old_proposal.wmo.WMOStatuses.NO_WMO
Expand Down
12 changes: 10 additions & 2 deletions reviews/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def get_queryset_for_committee(self):
reviewer=self.request.user,
review__proposal__reviewing_committee=self.committee,
review__continuation__lt=Review.Continuations.DISCONTINUED,
review__is_committee_review=True,
)

for obj in objects:
Expand All @@ -121,6 +122,7 @@ def get_queryset_for_secretary(self):
reviewer__groups__name=settings.GROUP_SECRETARY,
review__proposal__reviewing_committee=self.committee,
review__continuation__lt=Review.Continuations.DISCONTINUED,
review__is_committee_review=True,
)

for obj in objects:
Expand Down Expand Up @@ -171,6 +173,7 @@ def get_queryset_for_committee(self):
go="",
review__proposal__reviewing_committee=self.committee,
review__continuation__lt=Review.Continuations.DISCONTINUED,
review__is_committee_review=True,
)

for obj in objects:
Expand All @@ -195,6 +198,7 @@ def get_queryset_for_secretary(self):
go="",
review__proposal__reviewing_committee=self.committee,
review__continuation__lt=Review.Continuations.DISCONTINUED,
review__is_committee_review=True,
)

for obj in objects:
Expand Down Expand Up @@ -238,7 +242,8 @@ def get_queryset(self):
go="",
review__proposal__reviewing_committee=self.committee,
review__continuation__lt=Review.Continuations.DISCONTINUED,
).exclude(review__stage=Review.Stages.SUPERVISOR)
review__is_committee_review=True,
)

for obj in objects:
proposal = obj.review.proposal
Expand Down Expand Up @@ -288,7 +293,7 @@ class OpenSupervisorDecisionApiView(BaseDecisionApiView):
default_sort = ("proposal.date_submitted_supervisor", "desc")

def get_queryset(self):
"""Returns all proposals that still need to be reviewed by the secretary"""
"""Returns all proposals that still need to be reviewed by the supervisor"""
objects = Decision.objects.filter(
go="",
review__stage=Review.Stages.SUPERVISOR,
Expand Down Expand Up @@ -379,6 +384,7 @@ def get_queryset(self):
objects = (
Review.objects.filter(
stage__gte=Review.Stages.CLOSING,
is_committee_review=True,
proposal__status__gte=Proposal.Statuses.SUBMITTED,
proposal__date_confirmed=None,
proposal__reviewing_committee=self.committee,
Expand Down Expand Up @@ -440,6 +446,7 @@ def get_queryset(self):
proposal__reviewing_committee=self.committee,
stage=Review.Stages.CLOSED,
continuation=Review.Continuations.REVISION,
is_committee_review=True,
)
# 3. Finally, exclude candidates whose proposal
# has a child with a revision review
Expand Down Expand Up @@ -537,6 +544,7 @@ def get_queryset(self):
stage__gte=Review.Stages.ASSIGNMENT,
proposal__status__gte=Proposal.Statuses.SUBMITTED,
proposal__reviewing_committee=self.committee,
is_committee_review=True,
)
.select_related(
"proposal",
Expand Down
11 changes: 11 additions & 0 deletions reviews/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ def save(self, *args, **kwargs):
super(Decision, self).save(*args, **kwargs)
self.review.update_go(last_decision=self)

def is_final_decision(self):
"""
Checks if this is the final review in a reviewing round.
Will always return True on Supervisor reviews.
"""
open_decisions = self.review.decision_set.filter(
go="",
)
return open_decisions.count() < 2

def __str__(self):
return "Decision #%d by %s on %s: %s" % (
self.pk,
Expand Down
7 changes: 7 additions & 0 deletions reviews/templates/reviews/decision_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ <h2>{% trans "Aanvraag beoordelen" %}</h2>
De aanvraag is <a href="{{ pdf_url }}" target="_blank">hier</a> in te zien (downloadt als PDF).
{% endblocktrans %}
</p>
{% if decision.is_final_decision %}
<div class="alert alert-info">
{% blocktrans trimmed %}
<strong>Attentie:</strong> jij bent de laatste beoordelaar van deze aanvraag. Daarom kun je na het versturen je oordeel en commentaar niet meer bewerken. Controleer je antwoorden goed.
{% endblocktrans %}
</div>
{% endif %}
{% else %}
<p>
{% blocktrans trimmed with title=proposal.title %}
Expand Down
2 changes: 1 addition & 1 deletion reviews/templates/reviews/review_assign_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h2>{% trans "Commissieleden aanstellen" %}</h2>
{% blocktrans trimmed with title=review.proposal.title %}
<p>
Kies hier de geschikte route en commissieleden voor de aanvraag <em>{{ title }}</em>.
klik <a href="{{ workload_url }}">hier</a> voor een overzicht van de werkverdeling van deze commissie.
Klik <a href="{{ workload_url }}">hier</a> voor een overzicht van de werkverdeling van deze commissie.
</p>
{% endblocktrans %}
<form class="clearfix"
Expand Down
6 changes: 4 additions & 2 deletions reviews/utils/review_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def get_available_decision(self):
decision = Decision.objects.get(
review=review,
reviewer=user,
go="",
)
except Decision.DoesNotExist:
return None
Expand All @@ -115,7 +114,10 @@ def action_url(self):
def description(self):
decision = self.get_available_decision()

return _("Geef jouw beslissing en/of commentaar door")
if decision.go != "":
return _("Pas jouw beslissing en/of commentaar aan")
else:
return _("Geef jouw beslissing en/of commentaar door")


class CloseReview(ReviewAction):
Expand Down
5 changes: 2 additions & 3 deletions tasks/templates/tasks/session_confirm_delete.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ <h2>{% trans "Sessie verwijderen" %}</h2>
<p>
Weet u zeker dat u deze sessie <strong>{{ session.order }}</strong> in de aanvraag <em>{{ session.study.proposal.title }}</em> wilt verwijderen?
</p>
<input class="pure-button pure-button-primary"
<input class="button btn-danger"
type="submit"
value="{% trans 'Verwijderen' %}" />
<a class="pure-button pure-button-secondary"
href="javascript:history.go(-1)">{% trans "Annuleren" %}</a>
<a class="button" href="javascript:history.go(-1)">{% trans "Annuleren" %}</a>
</form>
</div>
</div>
Expand Down
5 changes: 2 additions & 3 deletions tasks/templates/tasks/task_confirm_delete.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ <h2>{% trans "Taak verwijderen" %}</h2>
<p>
Weet u zeker dat u de taak <strong>{{ task.name }}</strong> uit sessie <strong>{{ task.session.order }}</strong> in de aanvraag <em>{{ task.session.study.proposal.title }}</em> wilt verwijderen?
</p>
<input class="pure-button pure-button-primary"
<input class="button btn-danger"
type="submit"
value="{% trans 'Verwijderen' %}" />
<a class="pure-button pure-button-secondary"
href="javascript:history.go(-1)">{% trans "Annuleren" %}</a>
<a class="button" href="javascript:history.go(-1)">{% trans "Annuleren" %}</a>
</form>
</div>
</div>
Expand Down

0 comments on commit 4996f66

Please sign in to comment.