Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
Merge branch 'FS-3789-implement-shared-answer-class' of https://githu…
Browse files Browse the repository at this point in the history
…b.com/communitiesuk/digital-form-builder into FS-3789-implement-shared-answer-class
  • Loading branch information
Adam-W1 committed Jan 23, 2024
2 parents 5008f15 + 6216fc2 commit bb41f01
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
12 changes: 9 additions & 3 deletions python/answer_displayers/MultiInputField.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,17 @@ def as_txt(self) -> str | list[dict[str, AnswerDisplayer]]:
else:
multiinput_answer_rows = ""
multiinput_rows_answer_displayers = self._parse_multi_input_component
for index, multiinput_row_answer_displayers in enumerate(multiinput_rows_answer_displayers):
for index, multiinput_row_answer_displayers in enumerate(
multiinput_rows_answer_displayers
):
concat_answer_text = ""
for key, answer_displayer in multiinput_row_answer_displayers.items():
concat_answer_text = concat_answer_text + str(answer_displayer.as_txt) + "\n"
multiinput_answer_rows = multiinput_answer_rows + str(index + 1) + "\n" + concat_answer_text
concat_answer_text = (
concat_answer_text + str(answer_displayer.as_txt) + "\n"
)
multiinput_answer_rows = (
multiinput_answer_rows + str(index + 1) + "\n" + concat_answer_text
)
return multiinput_answer_rows

@property
Expand Down
5 changes: 3 additions & 2 deletions python/tests/test_MultiInputField.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_as_pdf(answer, expected_result):
"yuzbjT": 678,
"HpLJyL": {"HpLJyL__month": 4, "HpLJyL__year": 2024},
"MadvIr": "Capital",
}
},
],
[
{
Expand All @@ -74,7 +74,7 @@ def test_as_pdf(answer, expected_result):

_TEST_TEXT_OUTPUTS = [
"1\nTest Value for Money CYP Form FIRST\n£678.00\nMarch 2024\nCapital\n2\nTest Value for Money CYP Form SECOND\n£678.00\nApril 2024\nCapital\n",
'1\nTest About your organisation CYP Form\n268 Schultz Fold, Upper Berge, W12 0HS\nhttps://twitter.com/luhc\nNone\nNone\n'
"1\nTest About your organisation CYP Form\n268 Schultz Fold, Upper Berge, W12 0HS\nhttps://twitter.com/luhc\nNone\nNone\n",
]
_TEST_OUTPUTS = [
[
Expand All @@ -92,6 +92,7 @@ def test_as_pdf(answer, expected_result):
]
]


@pytest.mark.parametrize(
"answer, expected_answers",
zip(_TEST_INPUTS, _TEST_OUTPUTS),
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION=0.1.230
VERSION=0.1.231

0 comments on commit bb41f01

Please sign in to comment.