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

minor fix to text range evaluation

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