javrasya / django-river

Django workflow library that supports on the fly changes ⛵
BSD 3-Clause "New" or "Revised" License
741 stars 105 forks source link

Distinguishing if the workflow is 'completed' or'dropped'? #165

Closed noobmaster19 closed 4 years ago

noobmaster19 commented 4 years ago

Hey i have been messing with the package for sometime now and would like to raise a question. In real life scenarios , the workflow can either be treated as deactivated / dropped , or successfully completed . Its possible to replicate this by creating a branch to a final state. However , because the states can be named anything , it would not be possible for the program to recognize if the state is 'dropped' or 'completed' . Is there a solution to this that im unaware of?

javrasya commented 4 years ago

Hi @neowenshun , that is the way how django-river is designed. I mean, everything is meant to be a row in a database table so they can be changed anytime without touching the code. By nature, this is the responsibility of the developer who builds the app that uses django-river. You can create those states in the DB and make sure they can't change in a way so you can refer them in your code. But django-river doesn't offer such a thing since it is not aligned with what django-river is for.

javrasya commented 4 years ago

But if you want to check if your object is on the final state meaning that the workflow is completed for that object you can use instance level on-final-state api to know if the workflow is complete. That is best django-river can do unfortunately.

javrasya commented 4 years ago

Feel free to create a new ticket if the question still persists.