From b5210cb25294d8cb86596078d305ce2e30d7088d Mon Sep 17 00:00:00 2001 From: Onilton Maciel Date: Sat, 21 Feb 2015 22:43:49 -0200 Subject: [PATCH] Replacing really (really) broken for with .each This was a mistake of the original code from pull request #22. We were iterating on pointSeq (Fibonacci numbers). Actually we were iterating on the indices of this array, so we were stopping at the 9th item of the list always. Now we are iterating in all checklists items. --- trelloscrum.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/trelloscrum.js b/trelloscrum.js index 5bf78cf..56b956c 100644 --- a/trelloscrum.js +++ b/trelloscrum.js @@ -819,17 +819,17 @@ function calculateCheckListPoints() var $checkListItem = $('.checklist-list .checklist .checklist-items-list .checklist-item .checklist-item-details .checklist-item-details-text'); var estimateTotal = 0; var consumedTotal = 0; - for (var i in _pointSeq) - { - var estimateParsed = $checkListItem.eq(i).text().match(reg); - var consumedParsed = $checkListItem.eq(i).text().match(regC); + + $checkListItem.each(function(){ + var estimateParsed = $(this).text().match(reg); + var consumedParsed = $(this).text().match(regC); var estimatePoints = estimateParsed?estimateParsed[2]:0; var consumedPoints = consumedParsed?consumedParsed[2]:0; estimateTotal += Number(estimatePoints); consumedTotal += Number(consumedPoints); - } + }); return { estimateTotal: estimateTotal,