[virtualcommons-svn] commit/vcweb: alllee: guard for points past the points needed
Status: Beta
Brought to you by:
alllee
From: <com...@bi...> - 2013-04-05 06:56:30
|
1 new commit in vcweb: https://bitbucket.org/virtualcommons/vcweb/commits/292fd44b8e84/ Changeset: 292fd44b8e84 User: alllee Date: 2013-04-05 08:56:16 Summary: guard for points past the points needed Affected #: 1 file diff -r ebe513573e64954d75905b2eac3e7479a63e2514 -r 292fd44b8e84d4db60aa6eb2b97e1a47e47c0eaf vcweb/lighterprints/templates/lighterprints/participate.html --- a/vcweb/lighterprints/templates/lighterprints/participate.html +++ b/vcweb/lighterprints/templates/lighterprints/participate.html @@ -382,11 +382,12 @@ viewModel.todaysProgressChartData = ko.computed(function() { var avgPoints = viewModel.averagePoints(); var pointsToNextLevel = viewModel.pointsToNextLevel(); - console.debug(avgPoints + " / " + pointsToNextLevel) - return [ - { value: avgPoints, color: "#95CB29" }, - { value: pointsToNextLevel - avgPoints, color: "#D0D0D0" }, - ] + var data = [ { value: avgPoints, color: "#95CB29" } ] + var pointsNeeded = Math.max(0, pointsToNextLevel - avgPoints); + if (pointsNeeded > 0) { + data.push({ value: pointsNeeded, color: "#D0D0D0" }); + } + return data; }); viewModel.postComment = function(targetModel) { var formData = $('#commentForm' + targetModel.pk()).serialize(); Repository URL: https://bitbucket.org/virtualcommons/vcweb/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |