ankitects / anki

Anki's shared backend and web components, and the Qt frontend
https://apps.ankiweb.net
Other
18.97k stars 2.14k forks source link

Bug: Anki Deletes most/all of my IO clozes when modifying occlusion positions #3267

Open dae opened 4 months ago

dae commented 4 months ago

From the video, it looks like the grouping operation may be responsible.

Originally reported on https://forums.ankiweb.net/t/bug-anki-deletes-most-all-of-my-io-clozes-when-modifying-occlusion-positions/46524

hnvy commented 4 months ago

Hello,

looks like the grouping operation may be responsible

Sorry if the previous GIF made it seem like so, but I don't think it is. Here is another GIF of the issue without grouping:

Another example

hnvy commented 4 months ago

Here is the ZIP of the affected note BEFORE the damage.

Selected Notes BEFORE damage.zip

The issue is reproducible here (just rename it to apkg and import)

  1. Rename the file to APKG and import
  2. Open the browser (make sure you're using the Cards view)
  3. Find the note you just imported
  4. Move a rectangle
  5. Ctrl+N to go to next card (or Ctrl+P)
  6. The other rectangles vanish
dae commented 4 months ago

@abdnh interested in looking into this?

abdnh commented 4 months ago

No luck reproducing it with the provided card so far.

hnvy commented 4 months ago

No luck reproducing it with the provided card so far.

@abdnh The video below shows my steps on a new profile (from import to bug)

If you're still struggling, I am happy to be guided through the diagnostic process. I'll try to be as helpful as I can :)

Version ⁨24.06.2 (33a92379)⁩ --- Also on ⁨24.06.3 (d678e393)⁩
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Windows 10

https://github.com/ankitects/anki/assets/84394475/506f32d7-2192-4011-a3b6-09b3bc04a880

dae commented 4 months ago

The steps above work for me - how about you @abdnh?

abdnh commented 4 months ago

I was only able to reproduce it occasionally (first import in a fresh profile for some reason) but I think I know the cause. It's this width/height check here: https://github.com/ankitects/anki/blob/9d8782c31ca87b1de1a3d7e60d5bc4c2590479a1/ts/routes/image-occlusion/shapes/to-cloze.ts#L111

@krmanik I don't understand why such shapes are not valid. Can't we safely remove this? It was added in https://github.com/ankitects/anki/pull/3052

krmanik commented 4 months ago

The issue is that on clicking on canvas it add empty width/height shapes, so to exclude it, we need to check the size, the size can be decreased also.