Skip to content

Commit

Permalink
Add spent time for issues missing spent note
Browse files Browse the repository at this point in the history
This occurs when /spend is used during the creation of the issue
  • Loading branch information
Lilyheart committed Nov 21, 2019
1 parent a27c20b commit cbb4aaa
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions scripts/burndown.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ var burndown = (function () {
if (!dupDate) {
tempEstTimeList.push({date: date, estimateChange: estimate, issue: noteableIID, author: note.author.name});
}
// TODO to here
}

// if estimate is removed
Expand All @@ -351,6 +350,23 @@ var burndown = (function () {
spentTimeList = spentTimeList.concat(tempSpentTimeList);
estimateTimeList = estimateTimeList.concat(tempEstTimeList);

// *************************** END OF NOTE LOOP ***************************

// Spent Sanity check
issueListArr.forEach(function(issue) {
let loggedSpent, gitlabSpent;

loggedSpent = spentTimeList.filter(row => row.issue === issue.iid).reduce((acc, cur) => acc + cur.spent, 0);
gitlabSpent = issue.time_stats.total_time_spent / SECperHOUR;

if (loggedSpent !== gitlabSpent) {
date = new Date(issue.created_at);
date = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate());

spentTimeList.push({date: date, spent: gitlabSpent, issue: issue.iid, author: issue.author.name});
}
});

// Estimate Sanity check
issueListArr.forEach(function(issue) {
let loggedEst, gitlabEst;
Expand All @@ -362,7 +378,6 @@ var burndown = (function () {
date = new Date(issue.created_at);
date = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate());

// update estimateTimeList
estimateTimeList.push({date: date, estimateChange: gitlabEst, issue: issue.iid, author: issue.author.name});
}
});
Expand Down

0 comments on commit cbb4aaa

Please sign in to comment.