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

Conversation

Saurabhbalke
Copy link

overwiew

Code Requirement

  • The Optional material shouldn’t contribute to the users' progress % of the trackable collection and hence doesn’t contribute in the completion certificate criteria. For ex., if a course (which is a trackable collection) has 3 resources - 2 mandatory and 1 optional. If the batch which is offering this course has a certificate issue criteria = ‘issue certs to all users whose course progress is 100%’ then the certificate should be issued as soon as the user completes the 2 mandatory resources.

  • The optional material shouldn’t contribute to the final score calculation of the collection and hence doesn’t contribute in the merit certificate criteria. For ex., if a course (which is a trackable collection) has 3 resources - 2 mandatory and 1 optional. The optional resource is a course assessment. In this scenario, the certificate issue criteria should not show the option to issue certs based on score. Any batches which are offering this course should only be able to issue completion certificates. In the course ToC page, user should be able to view their latest attempt score. In the course progress exhaust as well the assessment score details should be shown.

  • Additional material can be a content within a module or all of them can be bundled together as a module.


Proof that changes are correct

cinnamon-2023-09-06T171015+0530.webm

Type of change

Please choose appropriate options.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Enhancement (additive changes to improve performance)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Saurabhbalke Saurabhbalke changed the title Support for Optional Material [C4GT] - Support for Optional Material Sep 6, 2023
@Saurabhbalke
Copy link
Author

@rajeevsathish sir, @princegupta1131 sir PTAL!!

@@ -541,10 +543,11 @@ export class AssessmentPlayerComponent implements OnInit, OnDestroy, ComponentCa
unit.isUnitConsumed = consumedContent.length === 1;
unit.progress = consumedContent.length ? 100 : 0;
unit.isUnitConsumptionStart = Boolean(consumedContent.length);
if(unit?.relationalMetadata?.optional=== false) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Saurabhbalke please describe the code in a comment

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hii @princegupta1131 sir,
added comments on the changes, PTAL!
thanks

@@ -595,6 +604,10 @@ 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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Saurabhbalke please try to make it more concise using this if (!unit?.relationalMetadata?.optional)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -566,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');
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Saurabhbalke please try to make it more concise using this && !(item?.relationalMetadata?.optional)

@sonarcloud
Copy link

sonarcloud bot commented Sep 7, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.11) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants