Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Stepan Kiryakov <[email protected]>
  • Loading branch information
Stepan-Kirjakov committed Oct 9, 2024
1 parent c851ab5 commit f93b1ef
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ export class SchemaFormulas {
}

public getJson(): any[] {
return this.formulas.map((f) => f.getJson());
return this.formulas.filter((f) => f.description || f.formula).map((f) => f.getJson());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,13 @@
<ng-container *ngIf="variable.isArray">
<div class="field-value-array">
<div *ngFor="let v of variable.value" class="field-value">
{{v}}
{{getVariableValue(v)}}
</div>
</div>
</ng-container>
<ng-container *ngIf="!variable.isArray">
<div class="field-value">
{{variable.value}}
{{getVariableValue(variable.value)}}
</div>
</ng-container>
</div>
Expand All @@ -266,13 +266,13 @@
<ng-container *ngIf="variable.isArray">
<div class="field-value-array">
<div *ngFor="let v of variable.value" class="field-value">
{{v}}
{{getVariableValue(v)}}
</div>
</div>
</ng-container>
<ng-container *ngIf="!variable.isArray">
<div class="field-value">
{{variable.value}}
{{getVariableValue(variable.value)}}
</div>
</ng-container>
</div>
Expand Down Expand Up @@ -313,13 +313,13 @@
<ng-container *ngIf="variable.isArray">
<div class="field-value-array">
<div *ngFor="let v of variable.value" class="field-value">
{{v}}
{{getVariableValue(v)}}
</div>
</div>
</ng-container>
<ng-container *ngIf="!variable.isArray">
<div class="field-value">
{{variable.value}}
{{getVariableValue(variable.value)}}
</div>
</ng-container>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ export class StatisticAssessmentConfigurationComponent implements OnInit {
} else if (result.length === 1) {
return result[0];
} else {
return 'N/A';
return undefined;
}
}

Expand All @@ -337,16 +337,12 @@ export class StatisticAssessmentConfigurationComponent implements OnInit {
if (value) {
value = value[path[i]]
} else {
return '';
return undefined;
}
}
if (value) {
return value;
} else {
return '';
}
return value;
} else {
return 'N/A';
return undefined;
}
}

Expand Down Expand Up @@ -380,7 +376,7 @@ export class StatisticAssessmentConfigurationComponent implements OnInit {
if (!this.document) {
return;
}
if(this.scores && this.scores.length) {
if (this.scores && this.scores.length) {
this.onStep(2);
} else {
this.onNextFinish();
Expand Down Expand Up @@ -422,12 +418,14 @@ export class StatisticAssessmentConfigurationComponent implements OnInit {

for (const formula of this.formulas) {
formula.value = this.calcFormula(formula, document);
if (formula.type === 'string') {
formula.value = String(formula.value);
} else {
formula.value = Number(formula.value);
if (formula.value) {
if (formula.type === 'string') {
formula.value = String(formula.value);
} else {
formula.value = Number(formula.value);
}
document[formula.id] = formula.value;
}
document[formula.id] = formula.value;
}
}

Expand All @@ -453,7 +451,9 @@ export class StatisticAssessmentConfigurationComponent implements OnInit {
const document: any = {};

for (const field of this.preview) {
document[field.id] = field.value;
if (field.value !== undefined) {
document[field.id] = field.value;
}
}
for (const score of this.scores) {
const option = score.options.find((o) => o.value === score.value);
Expand Down Expand Up @@ -486,4 +486,12 @@ export class StatisticAssessmentConfigurationComponent implements OnInit {
};
return report;
}

public getVariableValue(value: any): any {
if (value === undefined) {
return 'N/A';
} else {
return value;
}
}
}

0 comments on commit f93b1ef

Please sign in to comment.