-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Looping 2.5 - Simple Repeating Blocks in List Collector (No Item Prog…
…ress Tracking) (#1100) * Schema for repeating blocks and section summary incomplete + ListCollector Question handling many add types by enum. * Repeating blocks are presented to the user and can be answered however are not posted correctly and navigation not tested. * List Collector now always enters add_block & both add_block and edit_block go to repeating_blocks if existing. * make format * edit_block does not lead to repeating_blocks. All repeating_blocks show on list collector summary. * Blocks in repeating_blocks calculated upfront. Answers from repeating_blocks shown on list collector summary underneath the relevant list item. * Reverting list_collector handler and fixing invalid use of set * Return to summary reused throughout ListActions
- Loading branch information
1 parent
fe76286
commit 7bda62b
Showing
8 changed files
with
191 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from flask import url_for | ||
|
||
from app.views.handlers.list_edit_question import ListEditQuestion | ||
|
||
|
||
class ListRepeatingBlock(ListEditQuestion): | ||
def get_next_location_url(self) -> str: | ||
if self._is_returning_to_section_summary(): | ||
return self.get_section_summary_url() | ||
|
||
repeating_block_ids = [ | ||
block["id"] for block in self.parent_block["repeating_blocks"] | ||
] | ||
next_block_index = repeating_block_ids.index(self.rendered_block["id"]) + 1 | ||
if next_block_index < len(repeating_block_ids): | ||
repeating_block_url = url_for( | ||
"questionnaire.block", | ||
list_name=self._current_location.list_name, | ||
list_item_id=self._current_location.list_item_id, | ||
block_id=repeating_block_ids[next_block_index], | ||
return_to=self._return_to, | ||
return_to_answer_id=self._return_to_answer_id, | ||
return_to_block_id=self._return_to_block_id, | ||
) | ||
return repeating_block_url | ||
|
||
return super().get_next_location_url() |
Oops, something went wrong.