Open
Conversation
Changes src/utils/API/AuthService.js - Added deleteTrackingOfflineByRecord(user_id, course_id, content_id, lastAccessOn) — deletes a specific Tracking_Offline_2 record by its identifying columns after a successful API sync, preventing SyncCard from re-submitting it. src/screens/PlayerScreen/StandAlonePlayer/StandAlonePlayer.js — 4 changes: 1. fetchExitData restructured: writes to SQLite first (always, ~50ms), then fires the API in background. If API succeeds, calls deleteTrackingOfflineByRecord to remove the SQLite record. If API fails, the SQLite record stays for SyncCard to sync later. 2. Hardware back handler: added isExiting guard to absorb repeated presses, now returns true (blocks default back) and calls navigation.goBack() only after fetchExitData resolves. 3. handleMessage exit paths (lines 440, 499): already fixed earlier with await fetchExitData(). 4. YouTube exit button: onPress made async, now await fetchExitData() before navigation.goBack(). src/screens/Dashboard/Courses/UnitList.js - Removed the setTimeout(fetchDataTrack, 1000) hack. fetchDataTrack is now called directly since SQLite data is guaranteed to be written before navigation occurs.
Root cause: CourseCard, UnitCard, and ContentCard all gate their SQLite offline-tracking merge behind TrackData[i]?.courseId == course_id. If the
courseTrackingStatus API returns no server-side entry for a course (because the background contentTracking API call from fetchExitData hasn't completed
yet), the loop never finds a match and SQLite is never checked — so progress shows as 0%.
Fix applied in 3 files:
┌──────────────────────┬─────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ File │ Location │ What changed │
├──────────────────────┼─────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Courses.js │ onFopcusTrackCourse │ After building courseTrackData, inject stub entries { courseId, completed_list: [], │
│ │ │ in_progress_list: [] } for any course IDs missing from the server response │
├──────────────────────┼─────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Contents.js │ onFopcusTrackCourse │ Same — stub entries for all content IDs not in the server response │
├──────────────────────┼─────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ CourseContentList.js │ fetchDataTrack │ Same — ensure course_id always has an entry │
└──────────────────────┴─────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────┘
With stub entries present, the card components will find a match in the loop and call getSyncTrackingOfflineCourse, which reads the SQLite record
written synchronously by fetchExitData — so progress is visible immediately without a hard reload.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes for 3 JIRA issues
https://prathamdigitalteam.atlassian.net/browse/PS-6277
https://prathamdigitalteam.atlassian.net/browse/PS-6211
https://prathamdigitalteam.atlassian.net/browse/PS-6580
Review the file changes commit-wise to view changes.
Also added some code reviews, especially look at the program specific hardcodings