SF-3715 Send checkers to first book even when books are out of order#3688
SF-3715 Send checkers to first book even when books are out of order#3688
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3688 +/- ##
=======================================
Coverage 81.82% 81.82%
=======================================
Files 619 619
Lines 38619 38621 +2
Branches 6317 6293 -24
=======================================
+ Hits 31601 31603 +2
- Misses 6044 6057 +13
+ Partials 974 961 -13 ☔ View full report in Codecov by Sentry. |
pmachapman
left a comment
There was a problem hiding this comment.
@pmachapman reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Nateowami).
src/SIL.XForge.Scripture/ClientApp/src/app/checking/checking/resume-checking.service.ts line 118 at r1 (raw file):
// No questions, or all questions already answered. Send user to first book/chapter. const firstTextWithChapters = projectDoc.data?.texts .sort((a, b) => a.bookNum - b.bookNum)
Can you please add a .slice() before the .sort()?
Applying the sort() directly to the texts array can under certain circumstances cause the project doc in IndexedDB to have the texts array stored in a different order to MongoDB (cf. #2492).
Thanks!
Code quote:
const firstTextWithChapters = projectDoc.data?.texts
.sort((a, b) => a.bookNum - b.bookNum)b52272e to
ba5bda4
Compare
Nateowami
left a comment
There was a problem hiding this comment.
@Nateowami made 1 comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @pmachapman).
src/SIL.XForge.Scripture/ClientApp/src/app/checking/checking/resume-checking.service.ts line 118 at r1 (raw file):
Previously, pmachapman (Peter Chapman) wrote…
Can you please add a
.slice()before the.sort()?Applying the
sort()directly to thetextsarray can under certain circumstances cause the project doc in IndexedDB to have thetextsarray stored in a different order to MongoDB (cf. #2492).Thanks!
Thank you for catching this. I don't think I would have caught it, even though I know sort is in place, if I stopped to think about it.
What I'm not sure is how to avoid this mistake in the future, since depending on context, cloning the array isn't always necessary.
pmachapman
left a comment
There was a problem hiding this comment.
@pmachapman reviewed 1 file and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @Nateowami).
This change is