adapt-it / adapt-it-mobile

Translate between related languages on your mobile device.
https://adapt-it.github.io/adapt-it-mobile/
MIT License
27 stars 8 forks source link

Adapting: duplicate phrase entries #591

Closed eb1 closed 2 months ago

eb1 commented 2 months ago

Describe the bug While adapting, I came across a couple instances when moving forward to the next word/phrase to adapt, where the adaptation engine would recognize a phrase from the KB and suggest the translation, BUT it would enter the phrase multiple times in the text. Screen shot: dups

Note the "El qui" and "la seva" phrases are added several times in the text. Looking at the database, it appears that Adapt It Mobile has added this phrase several times to the sourcephrases table, with the same ID and order (i.e., these are true duplicates).

I was able to reproduce the behavior on the same phrases on an iOS and Android simulator -- looking at the debugger, it looks like it's hitting the maximum call stack size. This is not due to recursion, but to multiple nested calls:

 [Error] RangeError: Maximum call stack size exceeded.
stringify (sourcephrase.js:67)
create (sourcephrase.js:67)
sync (sourcephrase.js:107)
save (backbone-min.js:1:7260)
v (backbone-min.js:1:3358)
d (backbone-min.js:1:3083)
u (backbone-min.js:1:904)
(anonymous function) (backbone-min.js:1:2963)
set (backbone-min.js:1:5618)
save (backbone-min.js:1:6820)
unselectedAdaptation (AdaptViews.js:3042)
    (etc.)

To Reproduce Steps to reproduce the behavior:

  1. Launch AIM and create a project from Catalan to Spanish
  2. Import the attached file 43_jhn_cat.usfm.txt
  3. Adapt the text up to verse 16
  4. Note the multiple entries in the text.

Additional context Book of John in Catalan:

43_jhn_cat.usfm.txt

eb1 commented 2 months ago

Looks like this is still occurring without the stack overflow. Investigating further...