From 756376a60415894b18c0c629ce37437192204a18 Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Mon, 18 Dec 2017 17:14:43 +0000 Subject: [PATCH] add basic logging to the demo --- opentech/apply/templates/apply/demo_workflow.html | 5 +++++ opentech/apply/views.py | 7 +++++++ opentech/apply/workflow.py | 3 +-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/opentech/apply/templates/apply/demo_workflow.html b/opentech/apply/templates/apply/demo_workflow.html index 6817653d7..035647802 100644 --- a/opentech/apply/templates/apply/demo_workflow.html +++ b/opentech/apply/templates/apply/demo_workflow.html @@ -28,6 +28,11 @@ <h4>There are no actions</h4> {% endfor %} </form> + <ul> + {% for log in logs %} + <li>{{ log }}</li> + {% endfor %} + </ul> </section> <section class="container"> <a class="button" href="">Reset</a> diff --git a/opentech/apply/views.py b/opentech/apply/views.py index a2b1c043a..e4c712df7 100644 --- a/opentech/apply/views.py +++ b/opentech/apply/views.py @@ -7,6 +7,7 @@ from .workflow import SingleStage, DoubleStage workflows = [SingleStage, DoubleStage] +logs = [] def demo_workflow(request, wf_id): wf = int(wf_id) @@ -15,13 +16,19 @@ def demo_workflow(request, wf_id): current_phase = request.POST.get('current') if request.POST: + current = workflow.current(current_phase) phase = workflow.process(current_phase, request.POST['action']) + logs.append( + f'{current.stage}: {current.name} was updated to {phase.stage}: {phase.name}' + ) else: phase = workflow.current(current_phase) + logs.clear() context = { 'workflow': workflow, 'phase': phase, + 'logs': logs, } return TemplateResponse(request, 'apply/demo_workflow.html', context) diff --git a/opentech/apply/workflow.py b/opentech/apply/workflow.py index e918bb3ff..73655be0f 100644 --- a/opentech/apply/workflow.py +++ b/opentech/apply/workflow.py @@ -224,8 +224,7 @@ class ConceptStage(Stage): phases = [ DeterminationWithNextPhase(), ReviewPhase(), - DeterminationPhase(), - accepted, + DeterminationWithProgressionPhase(), rejected, ] -- GitLab