Skip to content

Commit

Permalink
fix: fixed to 2 decimals in the frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
yuelongh committed Sep 3, 2024
1 parent e153733 commit db2bbad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions app/javascript/components/stats/StatsCoverage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
v-if="hasNationalReport"
>
<span class="card__number block">
{{ protectedNationalReport }}%
{{ protectedNationalReportWithTwoDecimals }}%
</span>
{{ nationalReportVersion }}{{ textNationalReport }}
</p>
Expand Down Expand Up @@ -120,7 +120,9 @@ export default {
hasNationalReport () {
return this.protectedNationalReport != null && this.nationalReportVersion != null
},
protectedNationalReportWithTwoDecimals() {
return this.hasNationalReport? this.protectedNationalReport.toFixed(2):''
},
hasPameData () {
return this.pamePercentage != null && this.pameKm2 != null
}
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/statistic_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def method_missing method

nr_stat = "percentage_nr_#{land_type}_cover".to_sym
define_method(nr_stat) do
(@statistic.send(nr_stat) && @statistic.send(nr_stat) > 100.0) ? 100.0 : @statistic.send(nr_stat).round(2) rescue nil
(@statistic.send(nr_stat) && @statistic.send(nr_stat) > 100.0) ? 100.00 : @statistic.send(nr_stat) rescue nil
end

percent_oecm_stat = "percentage_oecms_pa_#{land_type}_cover".to_sym
Expand Down

0 comments on commit db2bbad

Please sign in to comment.