Commit 4f3fe0d9 authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

small fix to avoid unnecessary calls to the CTS API

parent b4c06296
......@@ -24,6 +24,7 @@ export class CorpusDetailPage {
private noTextRangeChosenString: string;
public CitationLevel = CitationLevel;
private invalidTextRangeString: string;
public isTransitioningToTextPage: boolean = false;
constructor(public navCtrl: NavController, public navParams: NavParams,
public corpusProvider: CorpusProvider,
......@@ -50,28 +51,30 @@ export class CorpusDetailPage {
}
showFurtherReferences(urn: string, currentCitationLevel: number, isStart: boolean) {
if (currentCitationLevel === 1 &&
this.corpusProvider.currentCorpus.citation_level_2 !== CitationLevel[CitationLevel.default]) {
// change display for further references
if (isStart) {
this.corpusProvider.currentTextRange.start[currentCitationLevel] = "";
}
else {
this.corpusProvider.currentTextRange.end[currentCitationLevel] = "";
}
this.checkFurtherReferences(urn, isStart, false);
if (!this.isTransitioningToTextPage) {
if (currentCitationLevel === 1 &&
this.corpusProvider.currentCorpus.citation_level_2 !== CitationLevel[CitationLevel.default]) {
// change display for further references
if (isStart) {
this.corpusProvider.currentTextRange.start[currentCitationLevel] = "";
}
else {
this.corpusProvider.currentTextRange.end[currentCitationLevel] = "";
}
this.checkFurtherReferences(urn, isStart, false);
}
else if (currentCitationLevel === 2 &&
this.corpusProvider.currentCorpus.citation_level_3 !== CitationLevel[CitationLevel.default]) {
// change display for further references
if (isStart) {
this.corpusProvider.currentTextRange.start[currentCitationLevel] = "";
}
else {
this.corpusProvider.currentTextRange.end[currentCitationLevel] = "";
else if (currentCitationLevel === 2 &&
this.corpusProvider.currentCorpus.citation_level_3 !== CitationLevel[CitationLevel.default]) {
// change display for further references
if (isStart) {
this.corpusProvider.currentTextRange.start[currentCitationLevel] = "";
}
else {
this.corpusProvider.currentTextRange.end[currentCitationLevel] = "";
}
this.checkFurtherReferences(urn, isStart, true);
}
this.checkFurtherReferences(urn, isStart, true);
}
}
......@@ -108,6 +111,7 @@ export class CorpusDetailPage {
toast.present().then();
}
else {
this.isTransitioningToTextPage = true;
this.adjustCurrentTextRange();
let startNumber: number = +this.corpusProvider.currentTextRange.start.join("");
let endNumber: number = +this.corpusProvider.currentTextRange.end.join("");
......
Supports Markdown
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