This refactors workflow and flow_control to make the logic more explicit, to be more readable and maintainable.
FIXED: Tests now pass.
The noteworthy changes are:
Refactored workflow definitions to be independent for testablity and clarity.
Split workflow processing with a submission out from workflow definition.
Refactored flow_control.py to isolate logic about submission, controller result, action => flow_control decision.
Changed the controllers and flow_control to no longer use BadRequest Exception and HTTP status as a single for form invalid to the flow_control and submit.routes.ui.ui.handle(). There are now functions in flow_control.py that controllers can use to mark a response as ready for next stage etc. At first I thought this was an unfortunate dependency but then it was clear that the controller actually depended on how the flow_control.py was expecting responses to be marked.
Some other changes:
Delete controllers split from file/package add controllers.
Change to how "seen" state of flow control is saved to make it more explicit. (Seen state is saved on the session, not on the submission. This has usability implications. A user will loose the seen state if the move to a different device. My first impression of this is that it will cause bugs in the field that we won't notice during testing.)
Removed path() from submit.routes.ui.ui to make the blueprint definitions more explicit about taking a parameter of submission_id.
This refactors workflow and flow_control to make the logic more explicit, to be more readable and maintainable.
FIXED: Tests now pass.
The noteworthy changes are:
Some other changes: