Fix rendering of multianswers, other small bug fixes

This commit is contained in:
Pieter Vander Vennet 2021-03-13 17:25:44 +01:00
parent 46254434db
commit ad08a55517
13 changed files with 68 additions and 62 deletions

View file

@ -46,37 +46,11 @@ export default class QuestionBox extends UIElement {
})
}
/**
* Returns true if it is known or not shown, false if the question should be asked
* @constructor
*/
IsKnown(tagRendering: TagRenderingConfig): boolean {
if (tagRendering.condition &&
!tagRendering.condition.matchesProperties(this._tags.data)) {
// Filtered away by the condition
return true;
}
if(tagRendering.multiAnswer){
for (const m of tagRendering.mappings) {
if(TagUtils.MatchesMultiAnswer(m.if, this._tags.data)){
return true;
}
}
}
if (tagRendering.GetRenderValue(this._tags.data) !== undefined) {
// This value is known and can be rendered
return true;
}
return false;
}
InnerRender(): string {
for (let i = 0; i < this._tagRenderingQuestions.length; i++) {
let tagRendering = this._tagRenderings[i];
if(this.IsKnown(tagRendering)){
if(tagRendering.IsKnown(this._tags.data)){
continue;
}