Jumoo / uSync.Complete.Issues

Public Issue tracker and roadmap for uSync.Complete
https://jumoo.co.uk/usync/complete/
2 stars 1 forks source link

Sync'ing dictionary items creates duplicate entries if number of languages in uSync file is different from number of languages defined in cms #100

Closed netaddicts closed 3 years ago

netaddicts commented 3 years ago

Describe the bug Currently have a couple of dictionary items in uSync which have 4 languages defined (which have been defined before in cms), but since some time ago, we have added 2 additional languages (while still keeping the existing uSync files as we didn't perform a save in cms), and on each startup (development mode does automatic import based on settings), dictionary items are duplicated (same unique id).

To Reproduce

  1. Make sure to have defined X languages in cms
  2. Create a dictionary item and save translations (uSync file should be created with x entries for the different translations - db also contains x records in cmsLanguageText table)
  3. Add another language
  4. Start umbraco site again (after a rebuild)

Expected behavior Didn't expect duplicate entries to be created in database, it now twice the amount of X records (backoffice still works fine, even though there's too many records in db) Expecting to have X records only in database One could argue whether uSync is "responsible" for creating the additional translation for the extra language added afterwards... that is probably open for discussion and up to the author to decide whether to create the dictionary item for the "missing" translation

Screenshots N/A

Desktop (please complete the following information): N/A

Smartphone (please complete the following information): N/A

Additional context Saving the dictionary entry will fix the usync file (now having X+1 entries for translations), and the next startup doesn't create the duplicate entries anymore.

KevinJump commented 3 years ago

Hi,

yeah looks like its a underling uSync8 issue - https://github.com/KevinJump/uSync8/issues/218

We will fix it there,

Just looking to see if we can do cleanup - (remove rouge lines from db) - looks like we can't do it via the Dictionary Services, it may require some SQL (if we can we will write a health check).

KevinJump commented 3 years ago

Hi, this is fixed in uSync 8.9.1 - which we have just pushed. (uSync.Complete 8.9.4 will update uSync too)

netaddicts commented 3 years ago

Hi @KevinJump does the fix also include some work to "remove the rough lines from db", or shall we still take care of it ourselves?

KevinJump commented 3 years ago

Hi it should also remove the extra lines, but only when it thinks there are changes to sync (so it won't remove them if it does report changes).

netaddicts commented 3 years ago

Not entirely sure i understand when it would delete them now, but we'll do a quick check by restarting one of our non production environments and verify the results after that... (well, we'll need to update to vLatest first when released)

Anyway, thanks for the swift response and support

KevinJump commented 3 years ago

my typo didn't help "it won't remove them if it doesn't report any changes"

or the other way around - I will only remove the extra columns as it is applying changes to the dictionary item - no changes no clean up.

netaddicts commented 3 years ago

Ok, thanks for clarifying!