Skip to content

Commit

Permalink
Merge pull request #76 from Sunbird-inQuiry/release-7.0.0
Browse files Browse the repository at this point in the history
Merge Release 7.0.0 to Release-8.0.0 branch
  • Loading branch information
sajeshkayyath authored Mar 12, 2024
2 parents 676553b + 66516ef commit fe219ce
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 157 deletions.
8 changes: 4 additions & 4 deletions projects/quml-library/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions projects/quml-library/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@project-sunbird/sunbird-quml-player",
"version": "7.0.2",
"version": "7.0.3",
"schematics": "./schematics/collection.json",
"ng-add": {
"save": "dependencies"
Expand All @@ -18,7 +18,7 @@
"@project-sunbird/client-services": "4.9.1"
},
"dependencies": {
"@project-sunbird/sunbird-player-sdk-v9": "6.0.0"
"@project-sunbird/sunbird-player-sdk-v9": "5.1.0"
},
"devDependencies": {
"copyfiles": "2.4.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { TransformationService } from '../services/transformation-service/transf
import { fakeMainProgressBar, fakeSections, playerConfig, singleContent } from './main-player.component.spec.data';
import { UtilService } from '../util-service';
import { of } from 'rxjs';
import { PLAYER_COMPATABILITY_CONFIG } from '../player-constants';

describe('MainPlayerComponent', () => {
let component: MainPlayerComponent;
Expand All @@ -25,7 +24,7 @@ describe('MainPlayerComponent', () => {
TestBed.configureTestingModule({
declarations: [MainPlayerComponent],
imports: [
SunbirdPlayerSdkModule.forRoot(PLAYER_COMPATABILITY_CONFIG),
SunbirdPlayerSdkModule,
CommonModule
],
providers: [QumlLibraryService, QuestionCursor],
Expand Down
4 changes: 1 addition & 3 deletions projects/quml-library/src/lib/player-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@ export const WARNING_TIME_CONFIG = {
SHOW_TIMER: true
}

export const PLAYER_COMPATABILITY_CONFIG = {
contentCompatibilityLevel: 6
}
export const COMPATABILITY_LEVEL: number = 6;
4 changes: 2 additions & 2 deletions projects/quml-library/src/lib/quml-library.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { SafeHtmlPipe } from './pipes/safe-html/safe-html.pipe';
import { MainPlayerComponent } from './main-player/main-player.component';
import { SectionPlayerComponent } from './section-player/section-player.component';
import { ProgressIndicatorsComponent } from './progress-indicators/progress-indicators.component'
import { PLAYER_COMPATABILITY_CONFIG } from './player-constants';

@NgModule({
declarations: [
QumlLibraryComponent,
Expand Down Expand Up @@ -80,7 +80,7 @@ import { PLAYER_COMPATABILITY_CONFIG } from './player-constants';
imports: [
CommonModule,
CarouselModule,
SunbirdPlayerSdkModule.forRoot(PLAYER_COMPATABILITY_CONFIG)
SunbirdPlayerSdkModule
],
providers: [
QumlLibraryService
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CommonModule } from '@angular/common';
import { ElementRef, EventEmitter, NO_ERRORS_SCHEMA } from '@angular/core';
import { waitForAsync, ComponentFixture, fakeAsync, flush, TestBed, tick } from '@angular/core/testing';
import { ErrorService, SunbirdPlayerSdkModule } from '@project-sunbird/sunbird-player-sdk-v9';
import { ErrorService } from '@project-sunbird/sunbird-player-sdk-v9';
import { CarouselComponent } from 'ngx-bootstrap/carousel';
import { of, Subject } from 'rxjs';
import { fakeMainProgressBar } from '../main-player/main-player.component.spec.data';
Expand All @@ -11,7 +11,6 @@ import { UtilService } from '../util-service';
import { QuestionCursor } from './../quml-question-cursor.service';
import { SectionPlayerComponent } from './section-player.component';
import { mockSectionPlayerConfig } from './section-player.component.spec.data';
import { PLAYER_COMPATABILITY_CONFIG } from '../player-constants';


describe('SectionPlayerComponent', () => {
Expand Down Expand Up @@ -52,14 +51,13 @@ describe('SectionPlayerComponent', () => {
TestBed.configureTestingModule({
declarations: [SectionPlayerComponent, CarouselComponent],
imports: [
CommonModule,
SunbirdPlayerSdkModule.forRoot(PLAYER_COMPATABILITY_CONFIG)
CommonModule
],
providers: [
QumlLibraryService,
QuestionCursor,
{ provide: ViewerService, useClass: ViewerServiceMock },
{ provide: ElementRef, useClass: ElementRefMock }
{ provide: ElementRef, useClass: ElementRefMock },
],
schemas: [NO_ERRORS_SCHEMA]
})
Expand Down Expand Up @@ -480,10 +478,10 @@ describe('SectionPlayerComponent', () => {
});

it('should check compatibility of the questionset', () => {
spyOn(errorService, 'checkContentCompatibility').and.returnValue(false);
spyOn(viewerService, 'raiseExceptionLog');
component['checkCompatibilityLevel'](3);
expect(errorService.checkContentCompatibility).toHaveBeenCalled();
spyOn(component, 'checkContentCompatibility').and.callThrough();
spyOn(viewerService, 'raiseExceptionLog').and.callFake(() => {});
component['checkCompatibilityLevel'](7);
expect(component.checkContentCompatibility).toHaveBeenCalled();
expect(viewerService.raiseExceptionLog).toHaveBeenCalled();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { takeUntil } from 'rxjs/operators';
import { QumlPlayerConfig, IParentConfig, IAttempts } from '../quml-library-interface';
import { ViewerService } from '../services/viewer-service/viewer-service';
import { eventName, pageId, TelemetryType, Cardinality, QuestionType } from '../telemetry-constants';
import { DEFAULT_SCORE } from '../player-constants';
import { DEFAULT_SCORE, COMPATABILITY_LEVEL } from '../player-constants';
import { UtilService } from '../util-service';

@Component({
Expand Down Expand Up @@ -91,6 +91,7 @@ export class SectionPlayerComponent implements OnChanges, AfterViewInit {
isAssessEventRaised = false;
isShuffleQuestions = false;
shuffleOptions: boolean;
playerContentCompatibiltyLevel = COMPATABILITY_LEVEL;

constructor(
public viewerService: ViewerService,
Expand Down Expand Up @@ -560,7 +561,9 @@ export class SectionPlayerComponent implements OnChanges, AfterViewInit {
private checkCompatibilityLevel(compatibilityLevel) {
/* istanbul ignore else */
if (compatibilityLevel) {
const checkContentCompatible = this.errorService.checkContentCompatibility(compatibilityLevel);
// TODO: It is a temporary fix for IQ-679 or ED-3398
// Before these changes we were calling errorService.checkContentCompatibility
const checkContentCompatible = this.checkContentCompatibility(compatibilityLevel);

/* istanbul ignore else */
if (!checkContentCompatible.isCompitable) {
Expand All @@ -570,6 +573,18 @@ export class SectionPlayerComponent implements OnChanges, AfterViewInit {
}
}

checkContentCompatibility(currentCompatibilityLevel: number) {
if (currentCompatibilityLevel > this.playerContentCompatibiltyLevel) {
const compatibilityError = new Error();
compatibilityError.message = `Player supports ${this.playerContentCompatibiltyLevel}
but content compatibility is ${currentCompatibilityLevel}`;
compatibilityError.name = 'contentCompatibily';
return { error: compatibilityError, isCompitable: false };
} else {
return { error: null, isCompitable: true };
}
}

emitSectionEnd(isDurationEnded: boolean = false, jumpToSection?: string) {
const eventObj: any = {
summary: this.createSummaryObj(),
Expand Down
2 changes: 1 addition & 1 deletion projects/quml-player-wc/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ import { ProgressIndicatorsComponent } from '../../../quml-library/src/lib/progr
BrowserModule,
CommonModule,
CarouselModule.forRoot(),
SunbirdPlayerSdkModule.forRoot({ contentCompatibilityLevel: 6 }),
SunbirdPlayerSdkModule,
HttpClientModule
],
providers: [{ provide: QuestionCursor, useClass: QuestionCursorImplementationService }]
Expand Down
2 changes: 1 addition & 1 deletion web-component/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@project-sunbird/sunbird-quml-player-web-component",
"version": "3.0.3",
"version": "3.0.4",
"description": "The web component package for the sunbird QuML player",
"main": "sunbird-quml-player.js",
"scripts": {
Expand Down
Loading

0 comments on commit fe219ce

Please sign in to comment.