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

introducing error messages to the UI

parent 58c742ea
{
"name": "mcClient",
"version": "0.4.5",
"version": "0.4.8",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
......
......@@ -10,6 +10,7 @@
"CASE_LOCATIVE": "Lokativ",
"CASE_NOMINATIVE": "Nominativ",
"CASE_VOCATIVE": "Vokativ",
"CORPORA_UNAVAILABLE": "Korpora nicht verfügbar :(",
"CORPORA_REFRESH": "Korpora aktualisieren",
"CORPUS_UPDATE_COMPLETED": "Korpus-Update abgeschlossen",
"DEPENDENCY_ADJECTIVAL_CLAUSE": "Attributsatz",
......@@ -45,6 +46,8 @@
"DEPENDENT_WORD": "Abhängiges Wort",
"EMAIL": "E-Mail",
"END": "Ende",
"ERROR_CITATIONS_UNAVAILABLE": "Zitierschema nicht verfügbar :(",
"ERROR_GENERAL_ALERT": "Huch, da ist etwas schief gelaufen... :(",
"EXERCISE_DOWNLOAD_NEXT_STEPS": "Nächste Schritte (XML)",
"EXERCISE_FEEDBACK": "Feedback",
"EXERCISE_FEEDBACK_CORRECT": "korrekt",
......
......@@ -10,6 +10,7 @@
"CASE_LOCATIVE": "Locative",
"CASE_NOMINATIVE": "Nominative",
"CASE_VOCATIVE": "Vocative",
"CORPORA_UNAVAILABLE": "Corpora unavailable :(",
"CORPORA_REFRESH": "Refresh corpora",
"CORPUS_UPDATE_COMPLETED": "Corpus update completed",
"DEPENDENCY_ADJECTIVAL_CLAUSE": "Adjectival Clause",
......@@ -45,6 +46,8 @@
"DEPENDENT_WORD": "Base word",
"EMAIL": "E-Mail",
"END": "End",
"ERROR_CITATIONS_UNAVAILABLE": "Citation scheme unavailable :(",
"ERROR_GENERAL_ALERT": "Oops, something went wrong... :(",
"EXERCISE_DOWNLOAD_NEXT_STEPS": "Next steps (XML)",
"EXERCISE_FEEDBACK": "Feedback",
"EXERCISE_FEEDBACK_CORRECT": "correct",
......
......@@ -8,6 +8,7 @@
<ion-navbar>
<ion-title>{{ 'EXERCISE_PARAMETERS' | translate }}</ion-title>
<ion-buttons end>
<ion-spinner *ngIf="HelperProvider.isLoading"></ion-spinner>
<button ion-button icon-only color="primary" (click)="HelperProvider.goToHomePage(navCtrl)">
<ion-icon name="home"></ion-icon>
</button>
......
......@@ -4,7 +4,7 @@ import {ExerciseProvider} from "../../providers/exercise/exercise";
import {
ExerciseType,
ExerciseTypeTranslation,
InstructionsTranslation,
InstructionsTranslation, MoodleExerciseType,
Phenomenon,
PhenomenonTranslation
} from "../../models/enum";
......@@ -13,6 +13,8 @@ import {HelperProvider} from "../../providers/helper/helper";
import {TranslateService} from "@ngx-translate/core";
import {CorpusProvider} from "../../providers/corpus/corpus";
import {QueryMC} from "../../models/queryMC";
import {AnnisResponse} from "../../models/annisResponse";
import {HttpClient, HttpErrorResponse} from "@angular/common/http";
/**
* Generated class for the ExerciseParametersPage page.
......@@ -41,7 +43,8 @@ export class ExerciseParametersPage {
public exerciseProvider: ExerciseProvider,
public toastCtrl: ToastController,
public translateService: TranslateService,
public corpusProvider: CorpusProvider) {
public corpusProvider: CorpusProvider,
public http: HttpClient) {
this.translateService.get("TEXT_TOO_LONG").subscribe(value => this.textTooLongString = value + HelperProvider.config["maxTextLength"]);
this.translateService.get("QUERY_VALUE_EMPTY").subscribe(value => this.emptyQueryValueString = value);
}
......@@ -82,11 +85,44 @@ export class ExerciseParametersPage {
}
else {
this.exerciseProvider.annisResponse.solutions = null;
// TODO: DISABLE HELPERPROVIDER ISVOCABULARYCHECK
this.navCtrl.push(PreviewPage).then();
this.getExerciseData();
}
}
private getExerciseData() {
let formData = new FormData();
let search_values: string[] = this.exerciseProvider.exercise.queryItems.map(query => query.phenomenon + "=" + query.values.join("|"));
// TODO: change the corpus title to something meaningful, e.g. concatenate user ID and wanted exercise title
formData.append("title", this.corpusProvider.currentUrn);
formData.append("text", this.corpusProvider.currentUrn);
formData.append("type", MoodleExerciseType[this.exerciseProvider.exercise.type]);
formData.append("type_translation", this.exerciseProvider.exercise.typeTranslation);
formData.append("search_values", JSON.stringify(search_values));
formData.append("instructions", this.exerciseProvider.exercise.instructionsTranslation);
formData.append("correct_feedback", this.exerciseProvider.exercise.feedback.correct);
formData.append("partially_correct_feedback", this.exerciseProvider.exercise.feedback.partiallyCorrect);
formData.append("incorrect_feedback", this.exerciseProvider.exercise.feedback.incorrect);
formData.append("general_feedback", this.exerciseProvider.exercise.feedback.general);
let url = HelperProvider.config["backendBaseUrl"] + HelperProvider.config["backendApiExercisePath"];
HelperProvider.currentError = null;
HelperProvider.isLoading = true;
this.http.post(url, formData).subscribe((ar: AnnisResponse) => {
HelperProvider.isLoading = false;
this.exerciseProvider.annisResponse.uri = ar.uri;
this.exerciseProvider.annisResponse.solutions = ar.solutions;
this.navCtrl.push(PreviewPage).then();
}, (error: HttpErrorResponse) => {
HelperProvider.isLoading = false;
HelperProvider.currentError = error;
let toast = this.toastCtrl.create({
message: HelperProvider.generalErrorAlertMessage,
duration: 3000,
position: 'top'
});
toast.present().then();
});
}
getSortedQueryValues(query: QueryMC) {
let targetObject: object = this.exerciseProvider.phenomenonMap[query.phenomenon][0];
return Object.keys(this.exerciseProvider.phenomenonMap[query.phenomenon][2]).sort((a, b) => {
......
......@@ -26,6 +26,8 @@ export class HomePage {
public corpusProvider: CorpusProvider,
public toastCtrl: ToastController) {
this.translate.get("CORPUS_UPDATE_COMPLETED").subscribe(value => this.corpusUpdateCompletedString = value);
// need to do this here because TranslateService is unavailable in the HelperProvider
this.translate.get("ERROR_GENERAL_ALERT").subscribe(value => HelperProvider.generalErrorAlertMessage = value);
}
goToAuthorPage() {
......@@ -38,14 +40,16 @@ export class HomePage {
refreshCorpora() {
this.isCorpusUpdateInProgress = true;
this.corpusProvider.getCorpora(0).then(() => {
this.corpusProvider.getCorpora(0).then((error?: any) => {
this.isCorpusUpdateInProgress = false;
let toast = this.toastCtrl.create({
message: this.corpusUpdateCompletedString,
duration: 3000,
position: 'top'
});
toast.present().then();
if (!error) {
let toast = this.toastCtrl.create({
message: this.corpusUpdateCompletedString,
duration: 3000,
position: 'top'
});
toast.present().then();
}
});
}
......
......@@ -9,6 +9,7 @@
<ion-navbar>
<ion-title>{{ 'PREVIEW' | translate }}</ion-title>
<ion-buttons end>
<ion-spinner *ngIf="HelperProvider.isLoading"></ion-spinner>
<button ion-button icon-only color="primary" (click)="HelperProvider.goToHomePage(navCtrl)">
<ion-icon name="home"></ion-icon>
</button>
......
......@@ -5,7 +5,7 @@ import {AnnisResponse} from "../../models/annisResponse";
import {ExerciseProvider} from "../../providers/exercise/exercise";
import {TranslateService} from "@ngx-translate/core";
import {CorpusProvider} from "../../providers/corpus/corpus";
import {ExerciseType, ExerciseTypeTranslation, FileType, MoodleExerciseType} from "../../models/enum";
import {ExerciseType, ExerciseTypeTranslation, FileType} from "../../models/enum";
import {HelperProvider} from "../../providers/helper/helper";
import {SolutionElement} from "../../models/solutionElement";
import {Solution} from "../../models/solution";
......@@ -44,31 +44,7 @@ export class PreviewPage {
public corpusProvider: CorpusProvider) {
this.currentSolutions = [];
this.currentNodes = [];
if (!this.exerciseProvider.annisResponse.solutions) {
this.getExerciseData();
}
}
private getExerciseData() {
let formData = new FormData();
let search_values: string[] = this.exerciseProvider.exercise.queryItems.map(query => query.phenomenon + "=" + query.values.join("|"));
// TODO: change the corpus title to something meaningful, e.g. concatenate user ID and wanted exercise title
formData.append("title", this.corpusProvider.currentUrn);
formData.append("text", this.corpusProvider.currentUrn);
formData.append("type", MoodleExerciseType[this.exerciseProvider.exercise.type]);
formData.append("type_translation", this.exerciseProvider.exercise.typeTranslation);
formData.append("search_values", JSON.stringify(search_values));
formData.append("instructions", this.exerciseProvider.exercise.instructionsTranslation);
formData.append("correct_feedback", this.exerciseProvider.exercise.feedback.correct);
formData.append("partially_correct_feedback", this.exerciseProvider.exercise.feedback.partiallyCorrect);
formData.append("incorrect_feedback", this.exerciseProvider.exercise.feedback.incorrect);
formData.append("general_feedback", this.exerciseProvider.exercise.feedback.general);
let url = HelperProvider.config["backendBaseUrl"] + HelperProvider.config["backendApiExercisePath"];
this.http.post(url, formData).subscribe((ar: AnnisResponse) => {
this.processAnnisResponse(ar);
}, (error) => {
console.log(error);
});
this.processAnnisResponse(this.exerciseProvider.annisResponse);
}
downloadExercise(type: string) {
......@@ -108,7 +84,6 @@ export class PreviewPage {
});
return newSolutions;
}
}
public processSolutions(solutions: Solution[]) {
......
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {IonicPage, NavController, NavParams, ToastController} from 'ionic-angular';
import {Sentence} from "../../models/sentence";
import {ShowTextPage} from "../show-text/show-text";
import {CorpusProvider} from "../../providers/corpus/corpus";
import {VocabularyProvider} from "../../providers/vocabulary/vocabulary";
import {HelperProvider} from "../../providers/helper/helper";
import {AnnisResponse} from "../../models/annisResponse";
import {HttpErrorResponse} from "@angular/common/http";
import {VocabularyCheckPage} from "../vocabulary-check/vocabulary-check";
import {ExerciseProvider} from "../../providers/exercise/exercise";
/**
* Generated class for the RankingPage page.
......@@ -24,14 +28,31 @@ export class RankingPage {
constructor(public navCtrl: NavController, public navParams: NavParams,
public corpusProvider: CorpusProvider,
public vocProvider: VocabularyProvider) {
public vocProvider: VocabularyProvider,
public exerciseProvider: ExerciseProvider,
public toastCtrl: ToastController) {
}
showText(rank: Sentence[]) {
// remove old sentence boundaries
this.corpusProvider.currentUrn = this.corpusProvider.currentUrn.split("@")[0];
this.corpusProvider.currentUrn += `@${rank[0].id}-${rank[rank.length - 1].id}`;
this.navCtrl.push(ShowTextPage).then();
HelperProvider.currentError = null;
HelperProvider.isLoading = true;
this.vocProvider.getVocabularyCheck(this.corpusProvider.currentUrn, true).subscribe((ar: AnnisResponse) => {
HelperProvider.isLoading = false;
this.exerciseProvider.processAnnisResponse(ar);
this.navCtrl.push(ShowTextPage).then();
}, (error: HttpErrorResponse) => {
HelperProvider.isLoading = false;
HelperProvider.currentError = error;
let toast = this.toastCtrl.create({
message: HelperProvider.generalErrorAlertMessage,
duration: 3000,
position: 'top'
});
toast.present().then();
});
}
}
......@@ -16,6 +16,7 @@ import {NodeMC} from "../../models/nodeMC";
import {LinkMC} from "../../models/linkMC";
import {VocabularyProvider} from "../../providers/vocabulary/vocabulary";
import {ExerciseParametersPage} from "../exercise-parameters/exercise-parameters";
import {HttpErrorResponse} from "@angular/common/http";
/**
* Generated class for the ShowTextPage page.
......@@ -35,7 +36,6 @@ export class ShowTextPage {
public ExerciseTypeTranslation = ExerciseTypeTranslation;
public Phenomenon = Phenomenon;
public PhenomenonTranslation = PhenomenonTranslation;
public currentText: string = "";
public textTooLongString: string;
public ObjectKeys = Object.keys;
public emptyQueryValueString: string;
......@@ -47,60 +47,6 @@ export class ShowTextPage {
public toastCtrl: ToastController,
public translateService: TranslateService,
public vocProvider: VocabularyProvider) {
this.corpusProvider.currentText = "";
if (HelperProvider.isVocabularyCheck) {
this.vocProvider.getVocabularyCheck(this.corpusProvider.currentUrn, true).subscribe((ar: AnnisResponse) => {
this.processAnnisResponse(ar);
});
}
else {
this.corpusProvider.getCTStextPassage(this.corpusProvider.currentUrn).subscribe((ar: AnnisResponse) => {
this.processAnnisResponse(ar);
});
}
}
processAnnisResponse(ar: AnnisResponse) {
Object.keys(this.exerciseProvider.phenomenonMap).forEach(key => this.exerciseProvider.phenomenonMap[key][2] = {});
this.exerciseProvider.phenomenonMap[Phenomenon.lemma][0] = {};
ar.graph.nodes.forEach((node: NodeMC) => {
let existingValue = this.exerciseProvider.phenomenonMap[Phenomenon.lemma][2][node.udep_lemma];
this.exerciseProvider.phenomenonMap[Phenomenon.lemma][2][node.udep_lemma] = (existingValue ? existingValue : 0) + 1;
this.exerciseProvider.phenomenonMap[Phenomenon.lemma][0][node.udep_lemma] = node.udep_lemma;
if (node.udep_feats) {
let featsParts: string[] = node.udep_feats.split("|");
let casePart: string = featsParts.find(x => x.toLowerCase().includes(Phenomenon[Phenomenon.case]));
if (casePart) {
let caseAbbreviation: string = casePart.split("=")[1];
let caseValue: CaseValue = this.corpusProvider.caseMap[caseAbbreviation];
existingValue = this.exerciseProvider.phenomenonMap[Phenomenon.case][2][caseValue];
this.exerciseProvider.phenomenonMap[Phenomenon.case][2][caseValue] = (existingValue ? existingValue : 0) + 1;
}
}
let pos: PartOfSpeechValue = this.corpusProvider.partOfSpeechMap[node.udep_upostag];
existingValue = this.exerciseProvider.phenomenonMap[Phenomenon.partOfSpeech][2][pos];
this.exerciseProvider.phenomenonMap[Phenomenon.partOfSpeech][2][pos] = (existingValue ? existingValue : 0) + 1;
});
// init the display with a (almost) random value
this.exerciseProvider.exercise.queryItems[0].values = [Object.keys(this.exerciseProvider.phenomenonMap[Phenomenon.partOfSpeech][2])[0]];
let pointingLinks: LinkMC[] = ar.graph.links.filter(x => x.annis_component_type === "Pointing");
pointingLinks.forEach((link: LinkMC) => {
let dep: DependencyValue = this.corpusProvider.dependencyMap[link.udep_deprel];
if (dep) {
let existingValue = this.exerciseProvider.phenomenonMap[Phenomenon.dependency][2][dep];
this.exerciseProvider.phenomenonMap[Phenomenon.dependency][2][dep] = (existingValue ? existingValue : 0) + 1;
}
});
// need to add root dependencies manually because they are tricky to handle
let nodeIds: string[] = ar.graph.nodes.map(x => x.id);
let nodesWithDependencySet: Set<string> = new Set<string>(pointingLinks.map(x => x.target));
let rootNodeIds: string[] = nodeIds.filter(x => !nodesWithDependencySet.has(x));
this.exerciseProvider.phenomenonMap[Phenomenon.dependency][2][DependencyValue.root] = rootNodeIds.length;
this.exerciseProvider.adjustQueryValue(this.exerciseProvider.exercise.queryItems[0]);
this.exerciseProvider.annisResponse = ar;
this.corpusProvider.currentText = ar.graph.nodes.map(x => x.annis_tok).join(" ");
}
goToExerciseParametersPage() {
......
......@@ -9,6 +9,7 @@
<ion-navbar>
<ion-title>{{corpusProvider.currentCorpus.title}}</ion-title>
<ion-buttons end>
<ion-spinner *ngIf="HelperProvider.isLoading"></ion-spinner>
<button ion-button icon-only color="primary" (click)="HelperProvider.goToHomePage(navCtrl)">
<ion-icon name="home"></ion-icon>
</button>
......
......@@ -9,6 +9,10 @@ import {Citation} from "../../models/citation";
import {BaseInput} from "ionic-angular/es2015/util/base-input";
import {VocabularyCheckPage} from "../vocabulary-check/vocabulary-check";
import {HelperProvider} from "../../providers/helper/helper";
import {HttpErrorResponse} from "@angular/common/http";
import {AnnisResponse} from "../../models/annisResponse";
import {ExerciseProvider} from "../../providers/exercise/exercise";
import {VocabularyProvider} from "../../providers/vocabulary/vocabulary";
/**
* Generated class for the CorpusDetailPage page.
......@@ -23,6 +27,7 @@ import {HelperProvider} from "../../providers/helper/helper";
templateUrl: 'text-range.html',
})
export class TextRangePage {
public citationsUnavailableString: string;
// TODO: rebuild the system so it works for any corpus of arbitrary citation depth
public showMultiPartText: boolean = false;
public CitationLevel = CitationLevel;
......@@ -40,25 +45,27 @@ export class TextRangePage {
public corpusProvider: CorpusProvider,
public toastCtrl: ToastController,
public translateService: TranslateService,
public viewCtrl: ViewController) {
public viewCtrl: ViewController,
public exerciseProvider: ExerciseProvider,
public vocProvider: VocabularyProvider) {
this.currentlyAvailableCitations = [];
this.corpusProvider.isTextRangeCorrect = false;
this.corpusProvider.currentTextRange = new TextRange({start: "", end: ""});
if (Object.keys(this.corpusProvider.currentCorpus.citations).length === 0) {
this.addReferences(this.corpusProvider.currentCorpus.citation_level_1).then(() => {
this.initPage();
}, () => {
});
}
else {
this.initPage();
}
this.translateService.get("INVALID_TEXT_RANGE").subscribe((value) => {
this.invalidTextRangeString = value;
});
this.translateService.get("INVALID_TEXT_RANGE").subscribe(value => this.invalidTextRangeString = value);
this.translateService.get("ERROR_CITATIONS_UNAVAILABLE").subscribe(value => this.citationsUnavailableString = value);
}
private addMissingCitations(citationLabelsStart: string[], citationLabelsEnd: string[]) {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
this.mapCitationLabelsToValues(citationLabelsStart[0], 0, citationLabelsStart, this.citationValuesStart).then(() => {
this.mapCitationLabelsToValues(citationLabelsEnd[0], 0, citationLabelsEnd, this.citationValuesEnd).then(() => {
if (citationLabelsStart.length > 1) {
......@@ -75,21 +82,24 @@ export class TextRangePage {
resolve();
}
});
});
}, () => reject());
}
else {
resolve();
}
});
});
}, () => reject());
});
}
private addReferences(targetCitationLevel: string, relevantCitations: Citation[] = []) {
let urnLastPart: string = relevantCitations.map(x => x.value.toString()).join(".");
let fullUrn: string = this.corpusProvider.currentCorpus.source_urn + (urnLastPart ? ":" + urnLastPart : "");
return new Promise(resolve => {
HelperProvider.currentError = null;
HelperProvider.isLoading = true;
return new Promise((resolve, reject) => {
this.corpusProvider.getCTSvalidReff(fullUrn).subscribe((result: string[] | object) => {
HelperProvider.isLoading = false;
let newCitations: Citation[] = [];
if (!Array.isArray(result)) {
// this is a custom corpus
......@@ -127,6 +137,16 @@ export class TextRangePage {
}
resolve();
});
}, (error: HttpErrorResponse) => {
HelperProvider.isLoading = false;
HelperProvider.currentError = error;
let toast = this.toastCtrl.create({
message: this.citationsUnavailableString,
duration: 3000,
position: 'top'
});
toast.present().then();
reject();
});
});
}
......@@ -190,10 +210,38 @@ export class TextRangePage {
else {
resolve(false);
}
}, () => {
// if the citation system does not work, we allow the user to choose the correct citations on his own
resolve(true);
});
});
}
private getText() {
this.corpusProvider.currentText = "";
if (HelperProvider.isVocabularyCheck) {
this.navCtrl.push(VocabularyCheckPage).then();
}
else {
HelperProvider.currentError = null;
HelperProvider.isLoading = true;
this.corpusProvider.getCTStextPassage(this.corpusProvider.currentUrn).subscribe((ar: AnnisResponse) => {
HelperProvider.isLoading = false;
this.exerciseProvider.processAnnisResponse(ar);
this.navCtrl.push(ShowTextPage).then();
}, (error: HttpErrorResponse) => {
HelperProvider.isLoading = false;
HelperProvider.currentError = error;
let toast = this.toastCtrl.create({
message: HelperProvider.generalErrorAlertMessage,
duration: 3000,
position: 'top'
});
toast.present().then();
});
}
}
private initPage() {
this.currentlyAvailableCitations = Object.keys(this.corpusProvider.currentCorpus.citations);
if (this.corpusProvider.currentCorpus.citation_level_2 === CitationLevel[CitationLevel.default]) {
......@@ -203,17 +251,26 @@ export class TextRangePage {
}
public mapCitationLabelsToValues(label: string, index: number, citationLabels: string[], valueList: number[]) {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
if (index === 0 && this.corpusProvider.currentCorpus.citations[label]) {
valueList.push(this.corpusProvider.currentCorpus.citations[label].value);
resolve();
}
else if (index === 1) {
if (!this.corpusProvider.currentCorpus.citations[citationLabels[index - 1]]) {
if (!!+label) {
valueList.push(+label);
resolve();
}
else {
reject();
}
}
if (Object.keys(this.corpusProvider.currentCorpus.citations[citationLabels[index - 1]].subcitations).length === 0) {
this.addReferences(this.corpusProvider.currentCorpus.citation_level_2, [this.corpusProvider.currentCorpus.citations[citationLabels[index - 1]]]).then(() => {
valueList.push(this.corpusProvider.currentCorpus.citations[citationLabels[index - 1]].subcitations[label].value);
resolve();
});
}, () => reject());
}
else {
valueList.push(this.corpusProvider.currentCorpus.citations[citationLabels[index - 1]].subcitations[label].value);
......@@ -221,11 +278,20 @@ export class TextRangePage {
}
}
else if (index === 2) {
if (!this.corpusProvider.currentCorpus.citations[citationLabels[index - 2]] || !this.corpusProvider.currentCorpus.citations[citationLabels[index - 2]].subcitations[citationLabels[index - 1]]) {
if (!!+label) {
valueList.push(+label);
resolve();
}
else {
reject();
}
}
if (Object.keys(this.corpusProvider.currentCorpus.citations[citationLabels[index - 2]].subcitations[citationLabels[index - 1]].subcitations).length === 0) {
this.addReferences(this.corpusProvider.currentCorpus.citation_level_3, [this.corpusProvider.currentCorpus.citations[citationLabels[index - 2]], this.corpusProvider.currentCorpus.citations[citationLabels[index - 2]].subcitations[citationLabels[index - 1]]]).then(() => {
valueList.push(this.corpusProvider.currentCorpus.citations[citationLabels[index - 2]].subcitations[citationLabels[index - 1]].subcitations[label].value);
resolve();
});
}, () => reject());
}
else {
valueList.push(this.corpusProvider.currentCorpus.citations[citationLabels[index - 2]].subcitations[citationLabels[index - 1]].subcitations[label].value);
......@@ -234,6 +300,7 @@ export class TextRangePage {
}
else if (!!+label) {
valueList.push(+label);
resolve();
}
});
}
......@@ -275,12 +342,7 @@ export class TextRangePage {
this.corpusProvider.currentUrn = newUrnBase + this.citationValuesStart.join(".") + "-" + this.citationValuesEnd.join(".");
this.corpusProvider.currentText = "";
this.corpusProvider.isTextRangeCorrect = true;
if (HelperProvider.isVocabularyCheck) {
this.navCtrl.push(VocabularyCheckPage).then();
}
else {
this.navCtrl.push(ShowTextPage).then();
}
this.getText();
});
}
......@@ -291,6 +353,8 @@ export class TextRangePage {
if (Object.keys(this.corpusProvider.currentCorpus.citations[citationLabels[0]].subcitations).length === 0) {
this.addReferences(this.corpusProvider.currentCorpus.citation_level_2, [this.corpusProvider.currentCorpus.citations[citationLabels[0]]]).then(() => {
resolve();
}, () => {
resolve();
});
}
else {
......@@ -309,6 +373,8 @@ export class TextRangePage {
if (Object.keys(this.corpusProvider.currentCorpus.citations[citationLabels[0]].subcitations[citationLabels[1]].subcitations).length === 0) {
this.addReferences(this.corpusProvider.currentCorpus.citation_level_3, [this.corpusProvider.currentCorpus.citations[citationLabels[0]], this.corpusProvider.currentCorpus.citations[citationLabels[0]].subcitations[citationLabels[1]]]).then(() => {
resolve();
}, () => {
resolve();
});
}
else {
......