Open frafra opened 3 years ago
What you're seeing is an unintended feature, not a bug. Though I expect what you really want is that when field type is changed, any test-plan using that template has its answers deleted. There's the issue #107 for fixing plans when a question is removed, this sounds like a variant of that.
(To be technical, there are the actual answers in Plan.data and the support table Answer. If the latter exists that should not affect this, if so we have a bug/thinko.)
Once upon a time, templates didn't have the "published"-state. This state has two purposes (they will be split in a future update):
The plan is to split this into two states, one for visbility and one to enforce that a template may no longer be changed. Until then...
A workaround is to create a new question, until we can get around to upping the smarts a little. (Superusers can get at the actual raw answers of any plan and delete/update them directly.) You could also try deleting a plan using that template.
You are the first person to seriously use the non-superuser "Template Designer" functionality, so it is to be expected that you run into unforeseen problems and edge cases.
To do:
choice
structure) from plans if the field type changes.The proposed workaround (define a new question and delete the previous one) works.
I think that it would be better to return an error and suggest deleting the related answers first, as deleting them without confirmation could be a bit excessive.
I have solved #107 now (validating a plan will remove "dead" answers to questions that no longer exist) so I'm thinking of automatically deleting such answers on any template save.
Which still doesn't fix the field type change issue but does give me ideas as to how to fix it.
I cannot switch field type if there are answers linked to the current question. The platform would just confirm that I saved, but the field type would not change. I think it would be better to stop the save action entirely if it is not possible to apply some changes.