From 71c4de41743a5e2c03d47a6523e7535bb7dd0061 Mon Sep 17 00:00:00 2001 From: Konstantin Schulz Date: Sat, 7 Dec 2019 09:33:54 +0000 Subject: [PATCH] exercise repository should not interfere with your own exercise texts --- package.json | 2 +- src/app/exercise-list/exercise-list.page.html | 10 +++++----- src/app/exercise-list/exercise-list.page.ts | 4 ++-- src/app/show-text/show-text.page.ts | 10 +++++++--- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 83b983a..530bd9f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mc_frontend", - "version": "1.4.5", + "version": "1.4.8", "author": "Ionic Framework", "homepage": "https://ionicframework.com/", "scripts": { diff --git a/src/app/exercise-list/exercise-list.page.html b/src/app/exercise-list/exercise-list.page.html index 4ef241e..4bf6de2 100644 --- a/src/app/exercise-list/exercise-list.page.html +++ b/src/app/exercise-list/exercise-list.page.html @@ -107,21 +107,21 @@ - + - + {{exercise.exercise_type_translation}} - + {{ getDateString(exercise.last_access_time) }} - + {{Math.round(exercise.text_complexity)}} - + {{getMatchingDegree(exercise)}} diff --git a/src/app/exercise-list/exercise-list.page.ts b/src/app/exercise-list/exercise-list.page.ts index c248b27..7d80d0e 100644 --- a/src/app/exercise-list/exercise-list.page.ts +++ b/src/app/exercise-list/exercise-list.page.ts @@ -116,8 +116,8 @@ export class ExerciseListPage implements OnInit { const url: string = HelperService.config['backendBaseUrl'] + HelperService.config['backendApiExercisePath']; const params: HttpParams = new HttpParams().set('eid', exercise.eid); HelperService.makeGetRequest(this.http, this.toastCtrl, url, params).then((ar: AnnisResponse) => { - HelperService.mostRecentSetup.annisResponse = ar; - this.helperService.saveMostRecentSetup().then(); + // save this exercise only locally in the CorpusService (not as MostRecentSetup in the HelperService) because + // users just want to have a quick look at it this.corpusService.annisResponse = ar; const met: MoodleExerciseType = MoodleExerciseType[exercise.exercise_type]; this.corpusService.exercise.type = ExerciseType[met.toString()]; diff --git a/src/app/show-text/show-text.page.ts b/src/app/show-text/show-text.page.ts index ca8ef94..629ed91 100644 --- a/src/app/show-text/show-text.page.ts +++ b/src/app/show-text/show-text.page.ts @@ -1,12 +1,12 @@ /* tslint:disable:no-string-literal */ -import {Component} from '@angular/core'; +import {Component, OnInit} from '@angular/core'; import {NavController, ToastController} from '@ionic/angular'; import {CorpusService} from 'src/app/corpus.service'; import {VocabularyService} from 'src/app/vocabulary.service'; import {ExerciseService} from 'src/app/exercise.service'; import {HelperService} from 'src/app/helper.service'; import {TranslateService} from '@ngx-translate/core'; -import {FileType} from '../models/enum'; +import {FileType, VocabularyCorpus} from '../models/enum'; import {HttpClient} from '@angular/common/http'; @Component({ @@ -14,7 +14,7 @@ import {HttpClient} from '@angular/common/http'; templateUrl: './show-text.page.html', styleUrls: ['./show-text.page.scss'], }) -export class ShowTextPage { +export class ShowTextPage implements OnInit { FileType = FileType; HelperService = HelperService; ObjectKeys = Object.keys; @@ -93,4 +93,8 @@ export class ShowTextPage { } return ''; } + + ngOnInit(): void { + this.vocService.currentReferenceVocabulary = this.vocService.currentReferenceVocabulary || VocabularyCorpus.bws; + } } -- GitLab