From f72cb38b10328d21f36ac3dfd688518971d2dcdb Mon Sep 17 00:00:00 2001 From: chrisala Date: Tue, 17 Dec 2024 13:08:28 +1100 Subject: [PATCH] Use 2 decimal places for overall targets #3392 --- grails-app/assets/javascripts/services.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grails-app/assets/javascripts/services.js b/grails-app/assets/javascripts/services.js index bcd8c4582..bba0faa7b 100644 --- a/grails-app/assets/javascripts/services.js +++ b/grails-app/assets/javascripts/services.js @@ -72,7 +72,8 @@ function OrganisationServicesViewModel(serviceIds, allServices, outputTargets, p target.serviceId = ko.observable(service ? service.id : null); target.scoreId = ko.observable(score ? score.scoreId : null); - target.target = ko.observable(); + var decimalPlaces = _.isNumber(score.decimalPlaces) ? score.decimalPlaces : 2; + target.target = ko.observable().extend({numericString: decimalPlaces}); target.targetDate = ko.observable().extend({simpleDate:false}); target.periodTargets = _.map(periods, function (period) { @@ -96,7 +97,7 @@ function OrganisationServicesViewModel(serviceIds, allServices, outputTargets, p var sum = 0; var count = 0; _.each(target.periodTargets, function (periodTarget) { - var target = parseInt(periodTarget.target()); + var target = parseFloat(periodTarget.target()); if (!_.isNaN(target)) { sum += target count++;