simonpoole/OpeningHoursFragment

Unexpected behaviour after the dialog “Update template value too?“ in ”Manage templates“

Opened this issue · 3 comments

I don't understand the dialog “Update template value too? (no/yes)“ and its behaviour – it appears after you edited something at a template in ”Manage templates“ (e.g. changing the name of the template) and press the SAVE button.

Dialog

What will or should be updated there? I also didn't find any information in the end user documentation at https://github.com/simonpoole/OpeningHoursFragment/blob/master/lib/documentation/docs/help/en/Opening%20hours.md.

What happens?

If I choose “YES“, all values in the template are deleted (there are no opening hours rules afterwards – it becomes an empty template). Is it a bug or am I missing something?

Only choosing ”NO“ seems to be a good choice here ....

(I tried it with Vespucci v16.1.0 from the Google Play Store; Android v9.1.0).

If you choose "Yes", the contents of the database will be updated with the contents of the current opening hours string in the editor (which potentially can be empty), if you select "No" just the meta data in the modal will be changed.

Yes this might not be totally, clear, if you have better wording ...

Hello!

OK – now I understand. And you seem to overlook something (and I didn't mention it clearly!) – apart from the wording:

If you go to ”Opening hours templates“ in the Vespucci preferences (that's what I did when I was playing around with this) you have the same screen for ”Manage templates“ as when an object is selected and you choose ”Manage templates“ in the menu of the opening hours editor!

And if you choose “YES“ there (in the Vespucci preferences) in this dialog (and the template surely has values!), all values in the template are really deleted (there are no opening hours rules afterwards – it becomes an empty template). Because there is nothing to be updated at that moment, I guess. I tried it again now and could reproduce it.

So I think you should check if any object is really selected and consider the case with the preferences start point ...

For the wording – hmmm. Perhaps:
“Replace the template value (= opening hour rules) with the value of the selected object?"
[I hope there is a check, that the values are really different before the dialog is shown.]

And perhaps you could also offer a second (warning) dialog, if the selected object has no opening hour rules – perhaps you removed it before going to ”Manage templates“ in the menu? – and existing values would be deleted if you press "yes". Like:

"This will remove all values of the template, because there are no opening hours defined in the selected object. Do you really want to to remove them? (yes/no)"

Or simply only show this dialog IF the selected object has a value for opening hours (AND they differ from the value of the template)?

Today, I deleted the values of a rule (a template) again (I was in the Vespucci preferences for the ”Opening hours templates“ again and wanted to make some changes) ... and forgot again, what this strange message “Update template value too? (no/yes)“ wants to tell me now ... and that there was this problem some time ago ... (It sounds as if it's a good idea to press "yes" – but it's a very bad idea if you are in the Vespucci preferences ...)

Luckily I had a backup of the entire rules ...

Wouldn't you like to improve this message? And the deleting behaviour if you are in the in the Vespucci preferences (and other details I mentioned above).

I was quite sure that this was a problem in the past ...