Skip to content

Commit

Permalink
fix: use appropriate accuracy for limits in web UI
Browse files Browse the repository at this point in the history
  • Loading branch information
schlimmchen committed Jul 22, 2024
1 parent 2539744 commit cea1dc4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions webapp/src/locales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,18 @@ LOCALES.forEach((locale) => {
decimalNoDigits: {
style: 'decimal', minimumFractionDigits: 0, maximumFractionDigits: 0
},
decimalOneDigit: {
style: 'decimal', minimumFractionDigits: 1, maximumFractionDigits: 1
},
decimalTwoDigits: {
style: 'decimal', minimumFractionDigits: 2, maximumFractionDigits: 2
},
percent: {
style: 'percent',
},
percentOneDigit: {
style: 'percent', minimumFractionDigits: 1, maximumFractionDigits: 1
},
byte: {
style: 'unit', unit: 'byte',
},
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<div style="padding-right: 2em;">
{{ $t('home.CurrentLimit') }}<template v-if="inverter.limit_absolute > -1"> {{
$n(inverter.limit_absolute, 'decimalNoDigits')
}} W | </template>{{ $n(inverter.limit_relative / 100, 'percent') }}
}} W | </template>{{ $n(inverter.limit_relative / 100, 'percentOneDigit') }}
</div>
<div style="padding-right: 2em;">
{{ $t('home.DataAge') }} {{ $t('home.Seconds', {'val': $n(inverter.data_age) }) }}
Expand Down Expand Up @@ -416,13 +416,13 @@ export default defineComponent({
currentLimitAbsolute(): string {
if (this.currentLimitList.max_power > 0) {
return this.$n(this.currentLimitList.limit_relative * this.currentLimitList.max_power / 100,
'decimalTwoDigits');
'decimalNoDigits');
}
return "0";
},
currentLimitRelative(): string {
return this.$n(this.currentLimitList.limit_relative,
'decimalTwoDigits');
'decimalOneDigit');
},
inverterData(): Inverter[] {
return this.liveData.inverters.slice().sort((a: Inverter, b: Inverter) => {
Expand Down

0 comments on commit cea1dc4

Please sign in to comment.