Skip to content

Commit

Permalink
Add review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
petechd committed Jun 17, 2024
1 parent 6451607 commit 946bb34
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/error_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
"Variants have more than one question type for block."
)
PREVIEW_WITHOUT_INTRODUCTION_BLOCK = "No introduction block found. Introduction block is mandatory when using the preview questions feature."
LIST_REFERENCED_BEFORE_ADDED = "List referenced as source before it has been created."
LIST_REFERENCED_BEFORE_CREATED = "List referenced as source before it has been created."
3 changes: 0 additions & 3 deletions app/validators/questionnaire_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,6 @@ def answers_with_context(self):

@property
def lists_with_context(self):
if self._lists_with_context:
return self._lists_with_context

if supplementary_list := self.supplementary_lists:
for list_id in supplementary_list:
self._lists_with_context[list_id] = {
Expand Down
4 changes: 2 additions & 2 deletions app/validators/questionnaire_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def validate_list_references(self):
< lists_with_context[list_identifier]["block_index"]
):
self.add_error(
error_messages.LIST_REFERENCED_BEFORE_ADDED.format(),
error_messages.LIST_REFERENCED_BEFORE_CREATED.format(),
list_id=list_identifier,
section_id=section["id"],
block_id=parent_block["id"],
Expand All @@ -169,7 +169,7 @@ def validate_list_references(self):
# Section level "enabled" rule that can use list source,
# check: common_definitions.json#/section_enabled
self.add_error(
error_messages.LIST_REFERENCED_BEFORE_ADDED.format(),
error_messages.LIST_REFERENCED_BEFORE_CREATED.format(),
list_name=list_identifier,
section_id=section["id"],
)
18 changes: 9 additions & 9 deletions tests/test_questionnaire_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,48 +415,48 @@ def test_list_as_source_referenced_before_created():
expected_errors = [
{
"list_id": "household",
"message": error_messages.LIST_REFERENCED_BEFORE_ADDED,
"message": error_messages.LIST_REFERENCED_BEFORE_CREATED,
"block_id": "individual-interstitial",
"section_id": "individuals-section",
},
{
"list_id": "household",
"message": error_messages.LIST_REFERENCED_BEFORE_ADDED,
"message": error_messages.LIST_REFERENCED_BEFORE_CREATED,
"block_id": "individual-interstitial",
"section_id": "individuals-section",
},
{
"list_id": "household",
"message": error_messages.LIST_REFERENCED_BEFORE_ADDED,
"message": error_messages.LIST_REFERENCED_BEFORE_CREATED,
"block_id": "list-status-2",
"section_id": "individuals-section",
},
{
"list_id": "household",
"message": error_messages.LIST_REFERENCED_BEFORE_ADDED,
"message": error_messages.LIST_REFERENCED_BEFORE_CREATED,
"block_id": "list-status-2",
"section_id": "individuals-section",
},
{
"list_id": "household",
"message": error_messages.LIST_REFERENCED_BEFORE_ADDED,
"message": error_messages.LIST_REFERENCED_BEFORE_CREATED,
"block_id": "list-status-2",
"section_id": "individuals-section",
},
{
"list_name": "household",
"message": error_messages.LIST_REFERENCED_BEFORE_ADDED,
"message": error_messages.LIST_REFERENCED_BEFORE_CREATED,
"section_id": "individuals-section",
},
{
"list_id": "utility-bills",
"message": error_messages.LIST_REFERENCED_BEFORE_ADDED,
"message": error_messages.LIST_REFERENCED_BEFORE_CREATED,
"block_id": "dynamic-answer",
"section_id": "utility-bills-section",
},
{
"list_id": "utility-bills",
"message": error_messages.LIST_REFERENCED_BEFORE_ADDED,
"message": error_messages.LIST_REFERENCED_BEFORE_CREATED,
"block_id": "dynamic-answer",
"section_id": "utility-bills-section",
},
Expand All @@ -476,7 +476,7 @@ def test_list_as_source_referenced_before_created_repeating_blocks():
expected_errors = [
{
"list_id": "companies",
"message": error_messages.LIST_REFERENCED_BEFORE_ADDED,
"message": error_messages.LIST_REFERENCED_BEFORE_CREATED,
"block_id": "any-other-companies-or-branches",
"section_id": "section-companies",
}
Expand Down

0 comments on commit 946bb34

Please sign in to comment.