Why django-viewflow internal table 'viewflow_task_previous' goes backwards?

71 Views Asked by At

Given the following steps defined

enter image description here

And when I dig into the internal tables, especially viewflow_task_previous table, it seems the from and to are reversed?

pmas=> select * from viewflow_task_previous where from_task_id = 10248;
  id  | from_task_id | to_task_id 
------+--------------+------------
 9099 |        10248 |      10247
(1 row)

pmas=> select id, status, flow_task, status from viewflow_task where id = 10248;
  id   |  status  |                                flow_task                                |  status  
-------+----------+-------------------------------------------------------------------------+----------
 10248 | ASSIGNED | connect_it/flows.new_circuit.flow.NewCircuit.external_task_installation | ASSIGNED
(1 row)

pmas=> select id, status, flow_task, status from viewflow_task where id = 10247;
  id   | status |                                flow_task                                | status 
-------+--------+-------------------------------------------------------------------------+--------
 10247 | DONE   | connect_it/flows.new_circuit.flow.NewCircuit.external_task_provisioning | DONE
(1 row)

Could someone explain why and how this works?

1

There are 1 best solutions below

0
On

viewflow_task_previous table created by models.ManyToManyField previous field of the Task model

https://github.com/viewflow/viewflow/blob/master/viewflow/models.py#L97

Yep, that gives some confusion on the SQL level