inventaire / inventaire-client

webapp coupled to the inventaire server :books:
https://inventaire.io
49 stars 16 forks source link

Duplicate shelves when importing multiple times #368

Closed arjanboltjes closed 1 year ago

arjanboltjes commented 1 year ago

I recently imported a list of 800+ plus books, from a LibraryThing .json file. The first time the majority of the books were imported, as mentioned on Mastodon here. However, some weren't, and after a quick fix and a patch from your side, I imported the same list a few more times.

Inventaire nicely only selected the books that had not been added yet from my file, yet. However, it also duplicated shelves read from the newly added books, while the same shelves were already in place based on the earlier import.

It would be nice:

  1. if this behaviour at import is fixed
  2. if we can merge existing shelves
jum-s commented 1 year ago

Hi, thank you for reporting.

Since the current state of your items/shelves comes from a patch/fix from our side, may i propose a hacky way to get there without touching the actual code : delete the old shelf and delete all its items too (youll be asked when deleteing the shelf) and reimporting a fresh new shelf? It would make it easier for the developers, than entering the blurry area of merging lists of elements which can be tricky.

maxlath commented 1 year ago

Alternatively to deleting everything, there is a way to manually merge shelves:

Still a hack, but indeed, we can hope that this kind of problem doesn't occur that often, and thus we can work on more urgent matters for now(?). Let's keep this issue open to see if other people encounter this problem.

arjanboltjes commented 1 year ago

Thanks for the replies. I indeed in the meantime did what @maxlath suggested, instead of removing and re-importing. This worked nicely, although the batch 'edit shelf' is overwriting the old shelves, by the looks of it. In due time it would be nice to have the availability to add a shelf to a selection without touching the other shelves.

Mostly fixed for me. I'll leave the issue open, as requested.

maxlath commented 1 year ago

Following #369, a basic deduplication is performed: if a shelf already exist with that exact same name, it will be reused, instead of creating a new shelf.