Skip to content

Commit

Permalink
changes based on git comments, formvalid over request.POST, and a few…
Browse files Browse the repository at this point in the history
… other minor changes
  • Loading branch information
Tllew committed Jan 7, 2025
1 parent 775b745 commit bf679f5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 0 additions & 4 deletions caseworker/advice/conditionals.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ def _get_form_field_boolean(wizard):

def is_fcdo_team(wizard):
return wizard.caseworker["team"]["alias"] == services.FCDO_TEAM


def is_ogd_team(wizard):
return not is_fcdo_team(wizard)
2 changes: 1 addition & 1 deletion caseworker/advice/forms/approval.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Layout:
TITLE = "Recommend an approval"

approval_reasons = forms.CharField(
widget=forms.Textarea(attrs={"rows": 7, "class": "govuk-!-margin-top-4", "name": "approval_reasons"}),
widget=forms.Textarea(attrs={"rows": 7, "class": "govuk-!-margin-top-4"}),
label="",
error_messages={"required": "Enter a reason for approving"},
)
Expand Down
2 changes: 1 addition & 1 deletion caseworker/advice/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def can_desnz_make_recommendation(user, case, queue_alias):


def can_ogd_make_edit(team):
return not team == services.FCDO_TEAM
return team != services.FCDO_TEAM


def case_has_approval_advice(advice):
Expand Down
11 changes: 7 additions & 4 deletions caseworker/advice/views/approval.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
from caseworker.advice.conditionals import form_add_licence_conditions, is_ogd_team
from caseworker.advice.conditionals import form_add_licence_conditions, is_fcdo_team
from caseworker.advice.forms.approval import (
FootnotesApprovalAdviceForm,
LicenceConditionsForm,
Expand All @@ -25,14 +25,17 @@ class SelectAdviceView(LoginRequiredMixin, CaseContextMixin, FormView):
form_class = SelectAdviceForm

def get_success_url(self):
recommendation = self.request.POST.get("recommendation")
if recommendation == "approve_all":
if self.recommendation == "approve_all":
if self.caseworker["team"]["alias"] == services.FCDO_TEAM:
return reverse("cases:approve_all_legacy", kwargs=self.kwargs)
return reverse("cases:approve_all", kwargs=self.kwargs)
else:
return reverse("cases:refuse_all", kwargs=self.kwargs)

def form_valid(self, form):
self.recommendation = form.cleaned_data["recommendation"]
return super().form_valid(form)

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
return {**context, "security_approvals_classified_display": self.security_approvals_classified_display}
Expand All @@ -47,7 +50,7 @@ class GiveApprovalAdviceView(LoginRequiredMixin, CaseContextMixin, BaseSessionWi
]

condition_dict = {
AdviceSteps.RECOMMEND_APPROVAL: C(is_ogd_team),
AdviceSteps.RECOMMEND_APPROVAL: ~C(is_fcdo_team),
AdviceSteps.LICENCE_CONDITIONS: C(form_add_licence_conditions(AdviceSteps.RECOMMEND_APPROVAL)),
AdviceSteps.LICENCE_FOOTNOTES: C(form_add_licence_conditions(AdviceSteps.RECOMMEND_APPROVAL)),
}
Expand Down

0 comments on commit bf679f5

Please sign in to comment.