webapp: Use max field to determine whether to show a string or not

This commit is contained in:
Thomas Basler 2023-09-04 19:54:07 +02:00
parent 1df8285833
commit c46f85db9c
2 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@ export interface ValueObject {
v: number; // value
u: string; // unit
d: number; // digits
max: number;
}
export interface InverterStatistics {

View File

@ -98,7 +98,7 @@
<template v-for="channel in Object.keys(chanType.obj).sort().reverse().map(x=>+x)" :key="channel">
<template v-if="(chanType.name != 'DC') ||
(chanType.name == 'DC' && getSumIrridiation(inverter) == 0) ||
(chanType.name == 'DC' && getSumIrridiation(inverter) > 0 && chanType.obj[channel].Irradiation?.v || 0 > 0)
(chanType.name == 'DC' && getSumIrridiation(inverter) > 0 && chanType.obj[channel].Irradiation?.max || 0 > 0)
">
<div class="col">
<InverterChannelInfo :channelData="chanType.obj[channel]"
@ -686,7 +686,7 @@ export default defineComponent({
getSumIrridiation(inv: Inverter): number {
let total = 0;
Object.keys(inv.DC).forEach((key) => {
total += inv.DC[key as unknown as number].Irradiation?.v || 0;
total += inv.DC[key as unknown as number].Irradiation?.max || 0;
});
return total;
}