DMPbelgium / roadmap

5 stars 1 forks source link

unpublish template can lead to change of existing plan structure #35

Closed nicolasfranck closed 1 year ago

nicolasfranck commented 2 years ago

cf. https://github.com/DMPRoadmap/roadmap/issues/2860

nicolasfranck commented 2 years ago

@laurastandaert

The controller that unpublishes the template, fetches all versions, sets the flag published to false, and then returns to the list of templates. That lists always shows the latest versions.

There are two scenario's in which you can hit the unpublish button:

1) You DID NOT make any changes after publishing

version published -> new attribute published
version-2 true -> false
version-1 false -> false
version-0 false -> false

2) You DID make changes. This is what they call "draft templates", i.e. unpublished templates that have a published version also. version-2 is draft here.

version published -> new attribute published
version-2 false -> false
version-1 true -> false
version-0 false -> false

Scenario 1) is problematic as now a template that was previously published (i.e. version-2), can be edited again, directly, which will alter the structure of existing plans.

Scenario 2) is not problematic, because the latest template version-2 was never published. So hitting "unpublish" when you're dealing with a draft template is fine

Conclusion: if the latest template version is published and has plans, then generate a new version for that

nicolasfranck commented 2 years ago

my PR https://github.com/DMPRoadmap/roadmap/pull/3143 is merged BTW

nicolasfranck commented 2 years ago

to be deployed on update of dmponline.be. See test.dmponline.be for newer version