Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2065,6 +2065,9 @@ describe('EnrolledCourseDetailsPage', () => {
}
]
};
jest.spyOn(enrolledCourseDetailsPage, 'getContentState').mockImplementation(() => {
return Promise.resolve();
});
enrolledCourseDetailsPage.contentStatusData = {
contentList: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1406,10 +1406,14 @@ export class EnrolledCourseDetailsPage implements OnInit, OnDestroy, ConsentPopo
private async startContent() {
if (this.courseHeirarchy && this.courseHeirarchy.children
&& this.courseHeirarchy.children.length && !this.isBatchNotStarted) {
if (this.nextContent && !this.nextContent) {
this.initNextContent();
if (!this.nextContent) {
await this.getContentState(true).then(() => {
this.navigateToContentDetails(this.nextContent, 1);
});
} else {
this.navigateToContentDetails(this.nextContent, 1);
}
this.navigateToContentDetails(this.nextContent, 1);
// this.navigateToContentDetails(this.nextContent, 1);
} else {
this.commonUtilService.showToast(this.commonUtilService.translateMessage('COURSE_WILL_BE_AVAILABLE',
this.datePipe.transform(this.courseStartDate, 'mediumDate')));
Expand All @@ -1420,7 +1424,13 @@ export class EnrolledCourseDetailsPage implements OnInit, OnDestroy, ConsentPopo
* Function gets executed when user click on resume course button.
*/
async resumeContent(): Promise<void> {
this.navigateToContentDetails(this.nextContent, 1);
if (!this.nextContent) {
await this.getContentState(true).then(() => {
this.navigateToContentDetails(this.nextContent, 1);
});
} else {
this.navigateToContentDetails(this.nextContent, 1);
}

this.telemetryGeneratorService.generateInteractTelemetry(InteractType.TOUCH,
InteractSubtype.RESUME_CLICKED,
Expand Down Expand Up @@ -1907,7 +1917,7 @@ export class EnrolledCourseDetailsPage implements OnInit, OnDestroy, ConsentPopo
this.courseUtilService.showCredits(this.course, this.pageId, undefined, this.corRelationList);
}

getContentState(returnRefresh: boolean) {
async getContentState(returnRefresh: boolean) {
if (this.courseCardData.batchId) {
const request: GetContentStateRequest = {
userId: this.appGlobalService.getUserId(),
Expand All @@ -1917,7 +1927,7 @@ export class EnrolledCourseDetailsPage implements OnInit, OnDestroy, ConsentPopo
batchId: this.courseCardData.batchId,
fields: ['progress', 'score']
};
this.courseService.getContentState(request).toPromise()
await this.courseService.getContentState(request).toPromise()
.then((contentStateResponse: ContentStateResponse) => {
this.contentStatusData = contentStateResponse;

Expand Down