Skip to content

Commit

Permalink
Use 2 decimal places for overall targets #3392
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisala committed Dec 17, 2024
1 parent ac6d561 commit f72cb38
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions grails-app/assets/javascripts/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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++;
Expand Down

0 comments on commit f72cb38

Please sign in to comment.