0

Please look at the following snippet: https://github.com/viewflow/viewflow/blob/fa48ec8b129171bceaa25c3ef4a7e6385c30ff6f/viewflow/activation.py#L364

  1. I don't understand why ViewActivation.prepare does not invoke self.task.save() after self.task.started = now().
  2. It seems that self.task.save() is invoked in other activations after self.task.started is set.

Is this a feature or a bug?

Background: I am currently building an analytics tool on top of viewflow for understanding the output performance of my team. I am trying to find out how long my users are spending per task by calculating task.finished - task.started.

kmmbvnr
  • 5,863
  • 4
  • 35
  • 44
Tinker
  • 4,165
  • 6
  • 33
  • 72

1 Answers1

0

Viewflow flow build from tasks, each task type is a separate finite state machine with own set of transitions. There is no restriction on what should happen inside a task activation transition. Task could be saved or not, depends on what logic desired at this place.

.prepare calls do not save the task b/c they happen on "HTTP GET" requests, that should be idempotent.

task.started tracked over the GET/POST activation.prepare/activation.done as a hidden form data from {{ activation.management_form }}

Extending task model and corresponding management_form would allow you to track any additional task execution information.

kmmbvnr
  • 5,863
  • 4
  • 35
  • 44