Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

Add and remove card types triggers a full sync even if user discards changes

Open sudomain opened this issue 4 years ago • 11 comments

Something I noticed while poking around CardTemplateEditor.java and TemporaryModel.java:

Reproduction Steps
  1. Add or remove a card type
  2. Agree to the full sync prompt
  3. Back out and discard changes
  4. Sync
Expected Result

Since the changes (either add or remove) were discarded, a full sync shouldn't be needed

Actual Result

Full sync is required

Debug info

Refer to the support page if you are unsure where to get the "debug info".

AnkiDroid Version = 2.12alpha3

Android Version = 7.0

ACRA UUID = 0f431910-fac3-4b52-ba37-64f328e5d239

Research

Enter an [x] character to confirm the points below:

  • [x ] I have read the support page and am reporting a bug or enhancement request specific to AnkiDroid
  • [x ] I have checked the manual and the FAQ and could not find a solution to my issue
  • [x ] I have searched for similar existing issues here and on the user forum
  • [x ] (Optional) I have confirmed the issue is not resolved in the latest alpha release (instructions)

sudomain avatar Jun 15 '20 21:06 sudomain

Unfortunately, once you trigger that I don't think it's possible to un-trigger it, but it does bear looking at, maybe it is possible to un-trigger that if the user doesn't save changes and I just missed it

mikehardy avatar Jun 15 '20 21:06 mikehardy

Incidentally, all the usage you are doing on CardTemplateEditor is much appreciated, it's not the most heavily used area of the code but it just saw so much change that more testing == more better :-)

mikehardy avatar Jun 15 '20 21:06 mikehardy

Unfortunately, once you trigger that I don't think it's possible to un-trigger it, but it does bear looking at, maybe it is possible to un-trigger that if the user doesn't save changes and I just missed it

I haven't looked into too much, but perhaps we can move the try / catch block and mTemplateEditor.getCol().modSchema(); line into the function that saves the model. Perhaps a separate prompt when adding/removing a card type saying "If you save this note type after adding or removing a card type, a full collection sync will be required" with an Ok button. I probably didn't explain this well, but I'll try it and get back to you.

sudomain avatar Jun 16 '20 01:06 sudomain

No - that was discussed quite a bit during development of 5151. The prompt for full sync needs to be associated-in-time with the action the user does that requires it, even though we don't actually do the save right then. That's inline with desktop actually.

mikehardy avatar Jun 16 '20 03:06 mikehardy

I don't think full sync is undoable on Anki Desktop either is it...?

On Tue, Jun 16, 2020 at 3:03 PM Mike Hardy [email protected] wrote:

No - that was discussed quite a bit during development of 5151. The prompt for full sync needs to be associated-in-time with the action the user does that requires it, even though we don't actually do the save right then. That's inline with desktop actually.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ankidroid/Anki-Android/issues/6475#issuecomment-644503137, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVQBYXQOCW3BPQKUDEP7LDRW3OJJANCNFSM4N6ZALQA .

timrae avatar Jun 16 '20 04:06 timrae

I don't think desktop collects changes made on the template screen, thus once an add/delete template change is made, there is no way to undo (other than download from ankiweb or restore a backup). It looks like this behavior is planned for desktop though (quoting from the 2.1.28alpha1 release notes):

`Card template screen:

Changes are now accumulated, and can be saved or discarded when you close the screen.`

I don't use the desktop alphas, so I can't comment.

EDIT: the discarding of changes feature is now in stable desktop Anki

sudomain avatar Jun 16 '20 04:06 sudomain

True, could be something we get 'for free' by switching to rust then

timrae avatar Jun 16 '20 05:06 timrae

Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

github-actions[bot] avatar Aug 15 '20 06:08 github-actions[bot]

Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

github-actions[bot] avatar Apr 16 '21 02:04 github-actions[bot]

@sudomain this should be fixed in 2.17, could you confirm when you have a second

david-allison avatar Feb 17 '24 05:02 david-allison

I reproduced it just now on 2.17beta3

sudomain avatar Feb 17 '24 17:02 sudomain