maltaisn/another-notes-app

Bug: Importing multiple back-ups

Closed this issue · 6 comments

So I am not sure if it's intended to be possible to add multiple backups, but one of two things should be done in my opinion:

  • If multiple back-up imports are not supposed to be possible, the user shouldn't even be allowed to do it and a pop-up should inform them of this.
  • If they are indeed supposed to be possible (which could be useful, so I don't see why disallow it), it currently causes bugs:

I had a back-up of my notes, but I also had the same notes already in the app. I then tried importing the back-up and it removed every single reminder I had set in the app. Many of the notes also got duplicated (presumably due to existing both in the app already and in the back-up). I am not sure if this is being done already, but I think all notes should be identified by IDs and whenever there is a collision of some ID the note from the back-up should override the note already in the app. As for the bug with reminders being removed, I am not sure why that even happens.

Steps to reproduce:

  1. Create back-up while there are multiple notes in the app, some of them with reminders set.
  2. Import the same back-up without changing anything.
  3. There should now be duplicates of notes and reminders should be gone.

Merging data is handled like this:

  • Notes are identified by ID. When importing a backup, if an ID is the same as well as the creation and modification date, then the note is considered to be the same and not added again.
  • In all other cases a new note is created to avoid losing user data inadvertently.
  • Since reminders don't change the modification date, the note is replaced and the reminder is lost.
  • Labels are merged by name and ID.

I won't do anything about duplicates because this is the expected behavior. I can fix the reminders disappearing.

Huh, that's strange. But if I imported immediately after exporting (I think that's what I did at least), shouldn't the IDs, creation and modification dates all been the same, in which case duplication wouldn't have happened? As for labels, I don't even use them, so can't give any input on that. And thanks, not having the reminders removed would be nice.

Actually now that I look again, if both the current note and the imported note have the same ID and last modification date, but a different reminder, then the note is duplicated to avoid losing the other reminder.

Except when comparing reminders, it checks whether the next event is on the same date, which isn't great if some time has passed since export. I changed it to only compare the reminder start date and recurrence.

That may explain the duplication in your case, but I'm not sure why the reminders were lost...

Should I try to make some instructions on how to reproduce the issue I experienced?

Sure.

I'll close this due to lack of information.