Skip to content

Fixes claude#188

Open
coolbung wants to merge 5 commits intomainfrom
fixes-claude
Open

Fixes claude#188
coolbung wants to merge 5 commits intomainfrom
fixes-claude

Conversation

@coolbung
Copy link
Copy Markdown
Member

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

  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.
@coolbung coolbung requested a review from rushi-tekdi April 10, 2026 19:12
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant