Commit 3ae9f9e7 authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

minor fix to text range evaluation

parent 8c980928
{ {
"name": "mcClient", "name": "mcClient",
"version": "0.2.1", "version": "0.2.2",
"author": "Ionic Framework", "author": "Ionic Framework",
"homepage": "http://ionicframework.com/", "homepage": "http://ionicframework.com/",
"private": true, "private": true,
......
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams, ToastController} from 'ionic-angular'; import {IonicPage, NavController, NavParams, ToastController} from 'ionic-angular';
import {CorpusProvider} from "../../providers/corpus/corpus"; import {CorpusProvider} from "../../providers/corpus/corpus";
import {GetValidReff} from "../../models/getValidReff";
import {CitationLevel} from "../../models/enum"; import {CitationLevel} from "../../models/enum";
import {ShowTextPage} from "../show-text/show-text"; import {ShowTextPage} from "../show-text/show-text";
import {TextRange} from "../../models/textRange"; import {TextRange} from "../../models/textRange";
...@@ -131,22 +130,25 @@ export class CorpusDetailPage { ...@@ -131,22 +130,25 @@ export class CorpusDetailPage {
checkTextRange(citationLabelsStart: string[], citationLabelsEnd: string[]) { checkTextRange(citationLabelsStart: string[], citationLabelsEnd: string[]) {
return new Promise(resolve => { return new Promise(resolve => {
let wholeTextRangeLabels: string[] = citationLabelsStart.concat(citationLabelsEnd);
if (this.corpusProvider.currentCorpus.citation_level_2 === CitationLevel[CitationLevel.default]) { if (this.corpusProvider.currentCorpus.citation_level_2 === CitationLevel[CitationLevel.default]) {
if (wholeTextRangeLabels.length > 2) { if (citationLabelsStart.length !== 1 || citationLabelsEnd.length !== 1) {
return false; resolve(false);
return;
} }
} }
else if (wholeTextRangeLabels.length <= 2) { else if (citationLabelsStart.length < 2 || citationLabelsEnd.length < 2) {
return false; resolve(false);
return;
} }
if (this.corpusProvider.currentCorpus.citation_level_3 === CitationLevel[CitationLevel.default]) { if (this.corpusProvider.currentCorpus.citation_level_3 === CitationLevel[CitationLevel.default]) {
if (wholeTextRangeLabels.length > 4) { if (citationLabelsStart.length !== 2 || citationLabelsEnd.length !== 2) {
return false; resolve(false);
return;
} }
} }
else if (wholeTextRangeLabels.length <= 4) { else if (citationLabelsStart.length !== 3 || citationLabelsEnd.length !== 3) {
return false; resolve(false);
return;
} }
this.citationValuesEnd = []; this.citationValuesEnd = [];
this.citationValuesStart = []; this.citationValuesStart = [];
......
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