diff --git a/packages/common-lib/src/services/courseRegistryService.js b/packages/common-lib/src/services/courseRegistryService.js index 1921f009..6368dea7 100644 --- a/packages/common-lib/src/services/courseRegistryService.js +++ b/packages/common-lib/src/services/courseRegistryService.js @@ -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) } diff --git a/packages/studentprogram/src/pages/lessonList.js b/packages/studentprogram/src/pages/lessonList.js index ae8dd4e7..b3e5491f 100644 --- a/packages/studentprogram/src/pages/lessonList.js +++ b/packages/studentprogram/src/pages/lessonList.js @@ -121,7 +121,7 @@ export default function LessonList({ footerLinks }) { }, [lessonId]); const handleExitButton = () => { - window.location.reload(); + navigate(0); setLesson(); setLessonId(); if ( @@ -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, @@ -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, @@ -478,7 +478,7 @@ export default function LessonList({ footerLinks }) { ) : ["application/vnd.ekstep.h5p-archive"].includes( subItem?.mimeType ) ? ( - +

H5P

) : ["video/x-youtube"].includes( subItem?.mimeType ) ? (