Commit 8d6fd4d0 authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

fixed two bugs for the test module in learning mode (evaluation & repeat test)

parent adf6e5ce
......@@ -8,13 +8,14 @@
Make sure to assign at least 4GB RAM (Memory) to the Docker container, otherwise the build will fail.
5. Run `docker-compose up -d` and enjoy!
----------------------------------------------------------------
##### Build
If you don't want to use Docker for building, you need to run `npm install` first.
##### Production Build
To build the application for production environments, use: `ionic cordova build browser --prod --release --max-old-space-size=4096` and serve the content of the `www/` folder, e.g. with Nginx.
----------------------------------------------------------------
##### Development
If you don't want to use Docker for development, you need to run `npm install` first, followed by `npm install @angular/cli`.
To spin up a local web server, run: `ng serve`. If you already ran `npm install` and the CLI still complains about missing dependencies, install them one by one using `npm install DEPENDENCY_NAME`.
To add new pages to the application, use: `ionic generate page PAGE_NAME`.
To spin up a local web server, run: `ng serve`.
----------------------------------------------------------------
##### Access to the Docker container
Use `docker-compose down` to stop and remove the currently running containers.
......
{
"name": "mc_frontend",
"version": "0.9.1",
"version": "0.9.2",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
......
......@@ -113,12 +113,12 @@
<ion-row>
<ion-col>
<ion-card>
<ion-item>
<ion-item *ngIf="isTestMode">
<ion-icon name="stats" slot="start"></ion-icon>
<ion-label position="stacked">
<h2>{{ 'RESULT' | translate }} {{ 'UNIT_DIAGNOSIS_TITLE' | translate}}</h2></ion-label>
<br>
{{results[0][0]}} {{ 'OF' | translate}} {{results[0][1]}}
{{results[resultsBaseIndex - 2][0]}} {{ 'OF' | translate}} {{results[resultsBaseIndex - 2][1]}}
{{ 'UNIT_EVALUATION_TASKS' | translate}}
</ion-item>
<ion-item>
......@@ -126,7 +126,7 @@
<ion-label position="stacked">
<h2>{{ 'RESULT' | translate }} {{ 'UNIT_APPLICATION_TITLE' | translate}}</h2>
</ion-label>
{{results[1][0]}} {{ 'OF' | translate}} {{results[1][1]}}
{{results[resultsBaseIndex - 1][0]}} {{ 'OF' | translate}} {{results[resultsBaseIndex - 1][1]}}
{{ 'UNIT_EVALUATION_TASKS' | translate}}
</ion-item>
<ion-item>
......@@ -134,11 +134,11 @@
<ion-label position="stacked">
<h2>{{ 'RESULT' | translate }} {{ 'UNIT_EXERCISE_TITLE' | translate}}</h2></ion-label>
<div *ngIf="testType == TestType.cloze; else list">
{{results[2][0]}} {{ 'OF' | translate}} {{results[2][1]}}
{{results[resultsBaseIndex][0]}} {{ 'OF' | translate}} {{results[resultsBaseIndex][1]}}
{{ 'UNIT_EVALUATION_GAPS' | translate }}
</div>
<ng-template #list>
{{results[2][0]}} {{ 'OF' | translate}} {{results[2][1]}}
{{results[resultsBaseIndex][0]}} {{ 'OF' | translate}} {{results[resultsBaseIndex][1]}}
{{ 'UNIT_EVALUATION_WORDS' |translate }}
{{knownCount[0]}}
</ng-template>
......@@ -147,11 +147,13 @@
<ion-icon name="pulse" slot="start"></ion-icon>
<ion-label position="stacked">
<h2>{{ 'RESULT' | translate }} {{ 'UNIT_TEST_TITLE' | translate}}</h2></ion-label>
{{results[3][0]}} {{ 'OF' | translate}} {{results[3][1]}}
{{results[resultsBaseIndex + 1][0]}} {{ 'OF' | translate}} {{results[resultsBaseIndex + 1][1]}}
{{ 'UNIT_EVALUATION_TASKS' | translate}}<br>
{{ 'UNIT_EVALUATION_CHANGE' | translate}}
{{ (((results[0][0] - results[3][0]) / (results[0][0] > 0 ? results[0][0] : 1)) * -100).toFixed(2) }}
%
<div *ngIf="isTestMode">
{{ 'UNIT_EVALUATION_CHANGE' | translate}}
{{ (((results[resultsBaseIndex - 2][0] - results[resultsBaseIndex + 1][0]) / (results[resultsBaseIndex - 2][0] > 0 ? results[resultsBaseIndex - 2][0] : 1)) * -100).toFixed(2) }}
%
</div>
</ion-item>
</ion-card>
</ion-col>
......
......@@ -91,11 +91,12 @@ export class TestPage implements OnDestroy, OnInit {
public h5pShowSolutionClassString = '.h5p-question-show-solution';
public h5pTextInputClassString = '.h5p-text-input';
public hideClassString = 'hide';
public isTestMode = true;
public isTestMode: boolean;
public knownCount: [number, number];
public nonH5Pstring = 'nonH5P';
public progressBarValue: number;
public results: [number, number][];
public resultsBaseIndex: number;
public testType: TestType;
public timer: any;
public timerIDstring = '#timer';
......@@ -151,25 +152,30 @@ export class TestPage implements OnDestroy, OnInit {
analyzeResults() {
this.results = [];
this.resultsBaseIndex = this.isTestMode ? 2 : 1;
const allTestIndices = Object.keys(this.vocService.currentTestResults).map(x => +x);
// pretest
let relevantTestIndices = allTestIndices.filter(x => x < this.currentExerciseParts[2].startIndex);
let correctlySolved: number[] = relevantTestIndices.filter((i) => {
return this.vocService.currentTestResults[i].statement.result.score.scaled === 1;
});
this.results.push([correctlySolved.length, relevantTestIndices.length]);
let relevantTestIndices: number[];
let correctlySolved: number[];
if (this.isTestMode) {
// pretest
relevantTestIndices = allTestIndices.filter(x => x < this.currentExerciseParts[this.resultsBaseIndex].startIndex);
correctlySolved = relevantTestIndices.filter((i) => {
return this.vocService.currentTestResults[i].statement.result.score.scaled === 1;
});
this.results.push([correctlySolved.length, relevantTestIndices.length]);
}
// text comprehension
this.addScore(allTestIndices, 2);
this.addScore(allTestIndices, this.resultsBaseIndex);
// exercises
relevantTestIndices = allTestIndices.filter(
x => this.currentExerciseParts[3].startIndex <= x && x < this.currentExerciseParts[4].startIndex);
relevantTestIndices = allTestIndices.filter(x => this.currentExerciseParts[this.resultsBaseIndex + 1].startIndex
<= x && x < this.currentExerciseParts[this.resultsBaseIndex + 2].startIndex);
correctlySolved = relevantTestIndices.map(i => this.vocService.currentTestResults[i].statement.result.score.raw);
const scoreObserved: number = correctlySolved.length ? correctlySolved.reduce((x, y) => x + y) : 0;
const scoreExpected: number = relevantTestIndices.length ? relevantTestIndices.map(
i => this.vocService.currentTestResults[i].statement.result.score.max).reduce((x, y) => x + y) : 0;
this.results.push([scoreObserved, scoreExpected]);
// posttest
this.addScore(allTestIndices, 4);
this.addScore(allTestIndices, this.resultsBaseIndex + 2);
this.currentState = TestModuleState.showResults;
}
......@@ -291,6 +297,7 @@ export class TestPage implements OnDestroy, OnInit {
}
ngOnInit(): void {
this.isTestMode = true;
this.randomizeTestType();
this.results = [];
this.wasDataSent = false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment