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

Issue #IQ-679 fix: Fix for IQ-567 - Telemetry while preview the Question set #73

Merged
merged 4 commits into from
Feb 16, 2024
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
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.