Fix tests, fix units

This commit is contained in:
Pieter Vander Vennet 2021-07-04 20:36:19 +02:00
parent 8b1b843dbe
commit fb3e3a040b
7 changed files with 52 additions and 17 deletions

View file

@ -37,6 +37,7 @@ export class Unit {
const possiblePostFixes = new Set<string>()
function addPostfixesOf(str){
str = str.toLowerCase()
for (let i = 0; i < str.length + 1; i++) {
const substr = str.substring(0,i)
possiblePostFixes.add(substr)
@ -178,11 +179,11 @@ export class Denomination {
}
}
} else {
if (value.endsWith(this.canonical) && this.canonical !== "") {
if (value.endsWith(this.canonical.toLowerCase()) && this.canonical !== "") {
return value.substring(0, value.length - this.canonical.length).trim();
}
for (const alternativeValue of this.alternativeDenominations) {
if (value.endsWith(alternativeValue)) {
if (value.endsWith(alternativeValue.toLowerCase())) {
return value.substring(0, value.length - alternativeValue.length).trim();
}
}

View file

@ -1,6 +1,7 @@
import TagRenderingConfig from "./JSON/TagRenderingConfig";
import * as questions from "../assets/tagRenderings/questions.json";
import * as icons from "../assets/tagRenderings/icons.json";
import {Utils} from "../Utils";
export default class SharedTagRenderings {
@ -14,7 +15,10 @@ export default class SharedTagRenderings {
try {
dict.set(key, new TagRenderingConfig(store[key], undefined, `SharedTagRenderings.${key}`))
} catch (e) {
console.error("BUG: could not parse", key, " from questions.json or icons.json - this error happened during the build step of the SharedTagRenderings", e)
if(!Utils.runningFromConsole){
console.error("BUG: could not parse", key, " from questions.json or icons.json - this error happened during the build step of the SharedTagRenderings", e)
}
}
}