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
Prevent IR request link from appearing on all interstitial pages #310
Conversation
…aire-runner into fix-request-link
app/views/handlers/content.py
Outdated
"show_individual_response_link": show_individual_response_link( | ||
self._current_location, self._schema | ||
) |
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.
Currently there's a lot of duplication here.
I would expect all the templates that show the IR link (hub/interstitial) to use the same variable for determining visibility of the link.
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.
Duplication removed, extra variable gone. Just need to add tests now👍.
Co-authored-by: Ian Wootten <hi@niftydigits.com>
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 need to add a test to ensure this bug doesn't resurface,
|
||
@staticmethod | ||
def show_individual_response(location, schema): | ||
section = schema.json.get("individual_response", {}).get( |
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 think you've misunderstood my original comment here - the first line here that returns the section_id should be a separate method I think and shouldn't be static when part of questionnaire_schema as schema is an instance of it. I think this method name should probably change too as it doesn't describe the check. Something like is_individual_response_interstitial
makes more sense.
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.
For this method, is_first_block_in_individual_response
is probably more appropriate since it being an interstitial is irrelevant?
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.
@iwootten that first line is now a method in Questionnaire Schema class. Thanks!
def get_individual_response_individual_section_id(self): | ||
return self._questionnaire_json.get("individual_response", {}).get( | ||
"individual_section_id" | ||
) |
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 be nice to group this with the other IR methods in this class for clarity.
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.
Moved it to ir group now.
Co-authored-by: Mebin Abraham <35296336+MebinAbraham@users.noreply.github.com>
What is the context of this PR?
This change prevents individual response link from appearing on all interstitial pages. Trello card.
How to review
Manually run
test_individual_response
schema to check if this change works, use test_individual_response.py integration test for automated testing.Checklist