Skip to content

courses: smoother progress unique inserting (fixes #13014)#13015

Merged
dogi merged 3 commits into
masterfrom
13014-realmprimarykeyconstraintexception-crash-due-to-duplicate-primary-key-during-bulk-sync
Apr 20, 2026
Merged

courses: smoother progress unique inserting (fixes #13014)#13015
dogi merged 3 commits into
masterfrom
13014-realmprimarykeyconstraintexception-crash-due-to-duplicate-primary-key-during-bulk-sync

Conversation

@Okuro3499
Copy link
Copy Markdown
Collaborator

fixes #13014
duplicates are found correctly via the PK lookup, and the object's _id field is always populated so any existing code that queries by _id elsewhere also works

Extract docId once from the incoming JSON and use it for Realm lookups/creation (changed query key from "_id" to "id"). When creating or fetching the RealmCourseProgress, assign the _id field explicitly and avoid repeated JsonUtils calls. This ensures correct lookup/creation of course progress records and that the _id is populated on the Realm object.
@dogi dogi changed the title sync: prevent duplicates (fixes #13014) courses: smoother progress unique inserting (fixes #13014) Apr 20, 2026
@dogi dogi merged commit 24dc15f into master Apr 20, 2026
4 checks passed
@Okuro3499 Okuro3499 deleted the 13014-realmprimarykeyconstraintexception-crash-due-to-duplicate-primary-key-during-bulk-sync branch April 20, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RealmPrimaryKeyConstraintException: Crash due to duplicate primary key during bulk sync

2 participants