fix stats NaN
parent
1a8fa8091e
commit
256de1a791
|
@ -73,7 +73,12 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
|
|||
loadProjectStats: ->
|
||||
return @rs.projects.stats(@scope.projectId).then (stats) =>
|
||||
@scope.stats = stats
|
||||
completedPercentage = Math.round(100 * stats.closed_points / stats.total_points)
|
||||
|
||||
if stats.total_points
|
||||
completedPercentage = Math.round(100 * stats.closed_points / stats.total_points)
|
||||
else
|
||||
completedPercentage = 0
|
||||
|
||||
@scope.stats.completedPercentage = "#{completedPercentage}%"
|
||||
return stats
|
||||
|
||||
|
|
|
@ -98,7 +98,12 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
|||
loadProjectStats: ->
|
||||
return @rs.projects.stats(@scope.projectId).then (stats) =>
|
||||
@scope.stats = stats
|
||||
completedPercentage = Math.round(100 * stats.closed_points / stats.total_points)
|
||||
|
||||
if stats.total_points
|
||||
completedPercentage = Math.round(100 * stats.closed_points / stats.total_points)
|
||||
else
|
||||
completedPercentage = 0
|
||||
|
||||
@scope.stats.completedPercentage = "#{completedPercentage}%"
|
||||
return stats
|
||||
|
||||
|
|
Loading…
Reference in New Issue