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-298: feat: override default value of shuffle in question set #11

Open
wants to merge 5 commits into
base: bootcamp
Choose a base branch
from
Open
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
21,391 changes: 21,267 additions & 124 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"e2e": "ng e2e",
"build-lib": "ng build quml-library && node scripts/copyAssets.js",
"postbuild-lib": "npm run build:schematics",
"serve": "node scripts/copyAssets.js && ng serve",
"serve": "node scripts/copyAssets.js && ng serve",
"build-web-component": "npm run build-lib && ng build quml-player-wc --output-hashing none && node ./build-wc.js",
"test-lib": "ng test quml-library",
"test-lib-coverage": "ng test quml-library --code-coverage=true",
Expand Down
41 changes: 24 additions & 17 deletions projects/quml-demo-app/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import { Component, OnInit } from '@angular/core';
import { samplePlayerConfig } from './quml-library-data';
import { DataService } from './services/data.service';
import { Component, OnInit } from "@angular/core";
import { samplePlayerConfig } from "./quml-library-data";
import { DataService } from "./services/data.service";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
selector: "app-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"],
})
export class AppComponent implements OnInit {
contentId = 'do_2137436878771650561181';
playerConfig: any;
contentId = "do_2137436878771650561181";
playerConfig: any = {};

constructor(private dataService: DataService) { }
constructor(private dataService: DataService) {}

ngOnInit() {
this.dataService.getQuestionSet(this.contentId).subscribe(res => {
this.dataService.getQuestionSet(this.contentId).subscribe((res) => {
this.initializePlayer(res);
});
}

initializePlayer(metadata) {
let qumlConfigMetadata: any = localStorage.getItem(`config_${this.contentId}`) || '{}';
let qumlConfigMetadata: any =
localStorage.getItem(`config_${this.contentId}`) || "{}";
let config;
if (qumlConfigMetadata) {
qumlConfigMetadata = JSON.parse(qumlConfigMetadata);
Expand All @@ -30,22 +31,28 @@ export class AppComponent implements OnInit {
context: samplePlayerConfig.context,
config: config ? config : samplePlayerConfig.config,
metadata,
data: {}
data: {},
};
}

getPlayerEvents(event) {
console.log('get player events', JSON.stringify(event));
console.log("get player events", JSON.stringify(event));

// Store the metaData locally
if (event.eid === 'END') {
if (event.eid === "END") {
let qumlMetaDataConfig = event.metaData;
localStorage.setItem(`config_${this.contentId}`, JSON.stringify(qumlMetaDataConfig));
this.playerConfig.config = { ...samplePlayerConfig.config, ...qumlMetaDataConfig };;
localStorage.setItem(
`config_${this.contentId}`,
JSON.stringify(qumlMetaDataConfig)
);
this.playerConfig.config = {
...samplePlayerConfig.config,
...qumlMetaDataConfig,
};
}
}

getTelemetryEvents(event) {
console.log('event is for telemetry', JSON.stringify(event));
console.log("event is for telemetry", JSON.stringify(event));
}
}
Loading