From 0f32cbe23767676deb04fe6399e58bf18ea15cec Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Tue, 18 Nov 2014 10:14:33 +0100 Subject: [PATCH] User story points are undefined if the task points are undefined --- app/coffee/modules/backlog/main.coffee | 5 +++-- app/coffee/modules/common/estimation.coffee | 11 ++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/coffee/modules/backlog/main.coffee b/app/coffee/modules/backlog/main.coffee index 080f5d1e..87ae636a 100644 --- a/app/coffee/modules/backlog/main.coffee +++ b/app/coffee/modules/backlog/main.coffee @@ -828,8 +828,9 @@ UsPointsDirective = ($repo) -> dom = $el.find("a > span.points-value") if roleId == null or numberOfRoles == 1 - dom.text(us.total_points) - dom.parent().prop("title", us.total_points) + totalPoints = if us.total_points? then us.total_points else "?" + dom.text(totalPoints) + dom.parent().prop("title", totalPoints) else pointId = us.points[roleId] pointObj = $scope.pointsById[pointId] diff --git a/app/coffee/modules/common/estimation.coffee b/app/coffee/modules/common/estimation.coffee index 48474107..6449fe5e 100644 --- a/app/coffee/modules/common/estimation.coffee +++ b/app/coffee/modules/common/estimation.coffee @@ -210,7 +210,7 @@ UsEstimationDirective = ($rootScope, $repo, $confirm) -> return $scope.project.my_permissions.indexOf("modify_us") != -1 render = (us) -> - totalPoints = us.total_points or 0 + totalPoints = if us.total_points? then us.total_points else "?" computableRoles = _.filter($scope.project.roles, "computable") roles = _.map computableRoles, (role) -> @@ -254,10 +254,15 @@ UsEstimationDirective = ($rootScope, $repo, $confirm) -> $el.find(".pop-points-open").show() calculateTotalPoints = (us) -> - values = _.map(us.points, (v, k) -> $scope.pointsById[v]?.value or 0) + values = _.map(us.points, (v, k) -> $scope.pointsById[v]?.value) if values.length == 0 return "0" - return _.reduce(values, (acc, num) -> acc + num) + + notNullValues = _.filter(values, (v) -> v?) + if notNullValues.length == 0 + return "?" + + return _.reduce(notNullValues, (acc, num) -> acc + num) $el.on "click", ".total.clickable", (event) -> event.preventDefault()