player level resume data changes#127
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the TrackingContentService to extract resumeData from a PROGRESS event within detailsObject instead of parsing the contentType string, and filters out PROGRESS events from being saved into the content details. The review feedback recommends improving code safety and readability by using strict equality and inequality operators, applying optional chaining to prevent runtime errors, and simplifying the redundant try-catch block when extracting resumeData.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| contentTrackingId = result.contentTrackingId; | ||
| } | ||
| if(detailsObject){ | ||
| const progressItem = detailsObject.find(item => item.eid == "PROGRESS"); |
There was a problem hiding this comment.
Use strict equality (===) and optional chaining (item?.eid) to prevent potential runtime errors if any item in detailsObject is null or undefined.
| const progressItem = detailsObject.find(item => item.eid == "PROGRESS"); | |
| const progressItem = detailsObject.find(item => item?.eid === 'PROGRESS'); |
| try{ | ||
| if(progressItem?.edata?.resumeData){ | ||
| createContentTrackingDto.resumeData=progressItem?.edata?.resumeData; | ||
| } | ||
| else{ | ||
| createContentTrackingDto.resumeData="0"; | ||
| } | ||
| } | ||
| else{ | ||
| createContentTrackingDto.resumeData="0"; | ||
| catch(e){ | ||
| } | ||
| let temp_resumeData=createContentTrackingDto.resumeData ? createContentTrackingDto.resumeData : 0; | ||
| await this.dataSource.query( | ||
| `UPDATE content_tracking set "resumeData"=$2 WHERE "contentTrackingId"=$1`, | ||
| [ | ||
| contentTrackingId, | ||
| temp_resumeData | ||
| ], | ||
| ); |
There was a problem hiding this comment.
The try-catch block is redundant here because optional chaining (progressItem?.edata?.resumeData) already safely handles potentially null or undefined values without throwing errors. Additionally, the logic can be simplified and made more readable by using a fallback value directly.
const resumeData = progressItem?.edata?.resumeData || '0';
createContentTrackingDto.resumeData = resumeData.toString();
await this.dataSource.query(
"UPDATE content_tracking set \"resumeData\"=$2 WHERE \"contentTrackingId\"=$1",
[
contentTrackingId,
resumeData
],
);| let eid = detail?.eid; | ||
| let edata = detail?.edata; | ||
| if (eid && edata) { | ||
| if (eid && edata && eid!='PROGRESS') { |
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |



No description provided.