Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C4GT] - Support for Optional Material #8911

Closed
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
added lint checks
  • Loading branch information
Saurabhbalke committed Sep 6, 2023
commit 00079f4764aee2d410146a347fd5a1364c605f06
Original file line number Diff line number Diff line change
@@ -546,7 +546,7 @@ export class AssessmentPlayerComponent implements OnInit, OnDestroy, ComponentCa
unit.isUnitConsumptionStart = Boolean(consumedContent.length);

// exclude optional material in both consumed content and total content in order to calculate course progress
if(unit?.relationalMetadata?.optional=== false) {
if(unit?.relationalMetadata?.optional === false) {
this.consumedContents = this.consumedContents + unit.consumedContent;
this.totalContents = this.totalContents + unit.contentCount;
}
Original file line number Diff line number Diff line change
@@ -571,7 +571,7 @@ export class CoursePlayerComponent implements OnInit, OnDestroy {

/* istanbul ignore else */
if (_.get(unit, 'children.length')) {
flattenDeepContents = this.courseConsumptionService.flattenDeep(unit.children).filter(item => item.mimeType !== 'application/vnd.ekstep.content-collection' && item.mimeType !== 'application/vnd.sunbird.question' && item?.relationalMetadata?.optional === false);
flattenDeepContents = this.courseConsumptionService.flattenDeep(unit.children).filter(item => item.mimeType !== 'application/vnd.ekstep.content-collection' && item.mimeType !== 'application/vnd.sunbird.question' && !(item?.relationalMetadata?.optional));
/* istanbul ignore else */
if (this.contentStatus.length) {
consumedContents = flattenDeepContents.filter(o => {
@@ -582,9 +582,8 @@ export class CoursePlayerComponent implements OnInit, OnDestroy {

unit.consumedContent = consumedContents.length;
// count mandatory content in module
this.totalModule +=flattenDeepContents.length;
this.consumedModule +=consumedContents.length;

this.totalModule = this.totalModule + flattenDeepContents.length;
this.consumedModule = this.consumedModule + consumedContents.length;
unit.contentCount = flattenDeepContents.length;
unit.isUnitConsumed = consumedContents.length === flattenDeepContents.length;
unit.isUnitConsumptionStart = false;
@@ -604,7 +603,7 @@ export class CoursePlayerComponent implements OnInit, OnDestroy {
unit.isUnitConsumed = consumedContent.length === 1;
unit.progress = consumedContent.length ? 100 : 0;
unit.isUnitConsumptionStart = Boolean(consumedContent.length);
if(unit?.relationalMetadata?.optional=== false) {
if(unit?.relationalMetadata?.optional === false) {
this.totalModule = this.totalModule + unit.consumedContent;
this.consumedModule = this.consumedModule + unit.contentCount;
}