Skip to content

Commit

Permalink
Replacing really (really) broken for with .each
Browse files Browse the repository at this point in the history
This was a mistake of the original code from pull request Q42#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.
  • Loading branch information
onilton committed Mar 5, 2015
1 parent e570904 commit b5210cb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions trelloscrum.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b5210cb

Please sign in to comment.