Skip to content

Commit

Permalink
Merge pull request #73 from rajnishdargan/7.0.0
Browse files Browse the repository at this point in the history
Issue #IQ-679 fix: Fix for IQ-567 - Telemetry while preview the Question set
  • Loading branch information
sajeshkayyath authored Feb 16, 2024
2 parents 68abfb3 + a0b3f66 commit 66516ef
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 10 deletions.
2 changes: 1 addition & 1 deletion 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 Down
4 changes: 3 additions & 1 deletion projects/quml-library/src/lib/player-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ export const DEFAULT_SCORE: number = 1;
export const WARNING_TIME_CONFIG = {
DEFAULT_TIME : 75,
SHOW_TIMER: true
}
}

export const COMPATABILITY_LEVEL: number = 6;
Original file line number Diff line number Diff line change
Expand Up @@ -478,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 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
24 changes: 23 additions & 1 deletion web-component/sunbird-quml-player.js

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

0 comments on commit 66516ef

Please sign in to comment.