Skip to content

Commit

Permalink
Allow number select item type to be printed
Browse files Browse the repository at this point in the history
  • Loading branch information
sultanofcardio committed Oct 29, 2024
1 parent 69a4f67 commit bf9dcf7
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 bf9dcf7

Please sign in to comment.