 
             $el.find(".pop-points-open").show()
 
-        calculateTotalPoints = (us) ->
-            values = _.map(us.points, (v, k) -> $scope.pointsById[v]?.value)
+        calculateTotalPoints = (points) ->
+            values = _.map(points, (v, k) -> $scope.pointsById[v]?.value)
             if values.length == 0
                 return "0"
 

        require: "ngModel"
    }

module.directive("tgUsEstimation", ["$rootScope", "$tgRepo", "$tgConfirm", "$tgQqueue", "$tgTemplate", UsEstimationDirective])

        save = $qqueue.bindAdd (roleId, pointId) =>
            $el.find(".popover").popover().close()

            points = _.clone($model.$modelValue.points, true)
            points[roleId] = pointId

            us = $model.$modelValue.clone()
            us.points = points
            $model.$setViewValue(us)

            onSuccess = ->
                $confirm.notify("success")
