Skip to content

Commit

Permalink
enable reset result to 0 or undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
luechtdiode committed Mar 31, 2024
1 parent 320b784 commit eda6b66
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ export class WertungAvgCalcComponent implements ControlValueAccessor {
.filter(item => !isNaN(item))
.filter(item => item > 0)
if (avg1.length === 0) {
return this.avgValue;
this.avgValue = undefined;
this.onChange(undefined);
console.log('value updated: ' + undefined);
return undefined;
}
const avg2 = Number((avg1.reduce((sum, current) => sum + current, 0) / avg1.length).toFixed(this.fixed));
if (!this.disabled && this.avgValue !== avg2 && !isNaN(avg2)) {
Expand Down

0 comments on commit eda6b66

Please sign in to comment.