Skip to content

Commit

Permalink
Merge pull request #1653 from ChildMindInstitute/release/1.8.1
Browse files Browse the repository at this point in the history
Release/1.8.1 [dev]
  • Loading branch information
mbanting authored Nov 7, 2024
2 parents cd06aa6 + b5462bb commit c03117b
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/apps/activities/domain/custom_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,20 @@ def validate_score_and_sections(values: dict): # noqa: C901
if not items[score_item_index].config.add_scores:
raise IncorrectScoreItemConfigError()

print_item_types = [
ResponseType.SINGLESELECT,
ResponseType.MULTISELECT,
ResponseType.SLIDER,
ResponseType.TEXT,
ResponseType.PARAGRAPHTEXT,
ResponseType.NUMBERSELECT,
]

for item in report.items_print:
if item not in item_names:
raise IncorrectScorePrintItemError()
else:
if items[item_names.index(item)].response_type not in [
ResponseType.SINGLESELECT,
ResponseType.MULTISELECT,
ResponseType.SLIDER,
ResponseType.TEXT,
ResponseType.PARAGRAPHTEXT,
]:
if items[item_names.index(item)].response_type not in print_item_types:
raise IncorrectScorePrintItemTypeError()

if report.conditional_logic:
Expand All @@ -147,13 +150,7 @@ def validate_score_and_sections(values: dict): # noqa: C901
if item not in item_names:
raise IncorrectScorePrintItemError()
else:
if items[item_names.index(item)].response_type not in [
ResponseType.SINGLESELECT,
ResponseType.MULTISELECT,
ResponseType.SLIDER,
ResponseType.TEXT,
ResponseType.PARAGRAPHTEXT,
]:
if items[item_names.index(item)].response_type not in print_item_types:
raise IncorrectScorePrintItemTypeError()

for report in list(sections):
Expand Down

0 comments on commit c03117b

Please sign in to comment.