Skip to content

Commit

Permalink
Merge pull request #58 from sagarkoshti1990/newaltv1-new
Browse files Browse the repository at this point in the history
fix:H5P Content Tracking Data
  • Loading branch information
ankush-maherwal authored Nov 25, 2024
2 parents 9df868f + e2636aa commit 0542193
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
30 changes: 18 additions & 12 deletions packages/common-lib/src/services/courseRegistryService.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,30 @@ export const lessontracking = async (
{ program, subject, ...params },
header = {}
) => {
const callApi = async () => {
const result = await post(
baseUrl + '/altlessontracking/altcheckandaddlessontracking',
params,
{ params: { program, subject }, headers }
)
if (result?.data?.data) {
return result.data?.data
}
return {}
}
let headers = {
...header,
Authorization: 'Bearer ' + sessionStorage.getItem('token')
}

try {
setTimeout(async () => {
const result = await post(
baseUrl + '/altlessontracking/altcheckandaddlessontracking',
params,
{ params: { program, subject }, headers }
)
if (result?.data?.data) {
return result.data?.data
} else {
return {}
}
}, 3000)
if (params?.contentType === 'vnd.ekstep.h5p-archive') {
return await callApi()
} else {
setTimeout(async () => {
return await callApi()
}, 3000)
}
} catch (e) {
console.log(e)
}
Expand Down
8 changes: 4 additions & 4 deletions packages/studentprogram/src/pages/lessonList.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default function LessonList({ footerLinks }) {
}, [lessonId]);

const handleExitButton = () => {
window.location.reload();
navigate(0);
setLesson();
setLessonId();
if (
Expand Down Expand Up @@ -175,7 +175,7 @@ export default function LessonList({ footerLinks }) {
lessonId: trimmedid,
status: "completed",
contentType: localStorage.getItem("contentType"),
timeSpent: inSeconds,
timeSpent: isNaN(inSeconds) ? 0 : inSeconds,
score: score,
scoreDetails: scoreDetails,
program: programData?.programId,
Expand All @@ -195,7 +195,7 @@ export default function LessonList({ footerLinks }) {
lessonId: lessonId?.identifier,
status: "completed",
contentType: localStorage.getItem("contentType"),
timeSpent: inSeconds,
timeSpent: isNaN(inSeconds) ? 0 : inSeconds,
score: score ? score : 0,
scoreDetails: scoreDetails,
program: programData?.programId,
Expand Down Expand Up @@ -478,7 +478,7 @@ export default function LessonList({ footerLinks }) {
) : ["application/vnd.ekstep.h5p-archive"].includes(
subItem?.mimeType
) ? (
<IconByName name="PlayFillIcon" isDisabled />
<H3>H5P</H3>
) : ["video/x-youtube"].includes(
subItem?.mimeType
) ? (
Expand Down

0 comments on commit 0542193

Please sign in to comment.