-
Notifications
You must be signed in to change notification settings - Fork 1
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
Ltd 5714 other ogd sessionwizard #2263
base: dev
Are you sure you want to change the base?
Conversation
3abfcc1
to
fec9881
Compare
38f2d86
to
b493985
Compare
a0a4030
to
80c4dcc
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.
A few minor suggestions throughout to clean this up a bit. Otherwise looking great
@@ -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"}), | |||
widget=forms.Textarea(attrs={"rows": 7, "class": "govuk-!-margin-top-4", "name": "approval_reasons"}), |
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'm surprised this "name": "approval_reasons"
is necessary. My understanding is that django injects that for you when this is rendered in the template.
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 agree. If it's added for a particular reason could we get a comment as to why?
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 believe this was me trying to force remove the form index from the approval reason, as the name here is formatted: formname-approval_reasons
ultimately this didn't work and I needed to change the ui tests to point to "recommend_approval-approval_reasons"
this is something the formwizard inserts so that you can have multiple fields with the same name in a single formwizard.
(removed now)
|
||
{% if buttons.edit_recommendation %} | ||
{% if can_user_make_desnz_edit %} | ||
{% if can_user_make_edit %} |
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 hadn't noticed before that there's sort of two parts to this permission; 1) can the user make the new edit expressed with this new django rule, 2) can the user make an edit at all, expressed with buttons.edit_recommendation
I feel like it would be good to get away from buttons.edit_recommendation
if we can and get to the django rules governing this completely.
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.
yeah this needs to be converted to use django rules everywhere.
get_advice_tab_context()
decides whether we show or hide button depending on current user etc and in template we use rules on top of that. We need to make changes in multiple places.
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've looked into this a little, I do agree we could remove the if buttons.
logic however there's some additional logic behind the edit_recommendation that I'm not confident we'd cover with the logic we have in the template, it seems like it could be a little out of scope at this stage in the LCDC project
form_class = SelectAdviceForm | ||
|
||
def get_success_url(self): | ||
recommendation = self.request.POST.get("recommendation") |
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.
Would recommend getting this from the form's cleaned_data rather by setting it as an instance variable in form_valid()
. We are otherwise getting the raw value rather than the cleaned one
@@ -28,7 +47,7 @@ class GiveApprovalAdviceView(LoginRequiredMixin, CaseContextMixin, BaseSessionWi | |||
] | |||
|
|||
condition_dict = { | |||
AdviceSteps.RECOMMEND_APPROVAL: C(is_desnz_team), | |||
AdviceSteps.RECOMMEND_APPROVAL: C(is_ogd_team), |
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 still don't get why this step is conditional. Once you're in the new flow, surely this step must show. We are handling whether or not to take users to the new or legacy flow outside of this view
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 is still excluding fcdo to ensure if you were to manually navigate to the page, you'd see an error.
def is_ogd_team(wizard): | ||
return not is_fcdo_team(wizard) |
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 feel this is named a bit confusingly as FCDO is an OGD and if I were reading this at the point of use this wouldn't be obvious 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.
because we're still excluding fcdo in this pr, i've changed the logic to be : ~C(is_fcdo_team)
and removed is_ogd_team to make this more obvious
@@ -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"}), | |||
widget=forms.Textarea(attrs={"rows": 7, "class": "govuk-!-margin-top-4", "name": "approval_reasons"}), |
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 agree. If it's added for a particular reason could we get a comment as to why?
def can_desnz_make_edit(team): | ||
return team in services.DESNZ_TEAMS | ||
def can_ogd_make_edit(team): | ||
return not team == services.FCDO_TEAM |
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.
!=
would probably be better here.
class WebDriverDelay: | ||
THIRTY = 30 | ||
FORTYFIVE = 45 | ||
TWENTY = 20 | ||
SIXTY = 60 |
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 presume that you're setting these so you can change them locally to higher values?
You could always set these as env variables instead (maybe with names that aren't literally the number) and then anyone could more easily add these and do it more permanently.
The only other thing I would say though is that I would double check whether something else is going on that is causing you to get so many failures locally with timeouts. It could be a symptom of something changing that is making pages load slowly that might be worth proactively fixing.
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 was written and added in frustration, an env variable is a nice idea, I kept it in so that if someone else was to hit this and for some reason try to modify the delay then they wouldn't need to manually update each instance of the webdriverwait
Brendan helped me resolve the slow tests in the end, in the end it was:
CELERY_ALWAYS_EAGER=True
That resolved the failing and hanging tests.
I'm happy to either:
- remove this as a constant
- convert it to an env variable
which would you prefer?
083c5c4
to
775b745
Compare
replaced is_desnz with is_ogd team to ensure fcdo can't access the site manually
only sending to legacy view when fcdo team
LTD-5714