Skip to content

Commit 92cea91

Browse files
committed
re-rendering on nnumber of commits change
Signed-off-by: Vedansh Saini <[email protected]>
1 parent 4303dc8 commit 92cea91

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/scripts/main.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,11 @@ function handleShowCommitsChange() {
263263
function handleNumCommitsChange() {
264264
let value = numCommitsElement.value;
265265
chrome.storage.local.set({ numCommits: value });
266+
if(window.generateScrumReport) {
267+
window.generateScrumReport();
268+
} else if(typeof allIncluded === 'function') {
269+
allIncluded('popup');
270+
}
266271
}
267272
enableToggleElement.addEventListener('change', handleEnableChange);
268273
githubUsernameElement.addEventListener('keyup', handleGithubUsernameChange);

src/scripts/scrumHelper.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,8 @@ function allIncluded(outputTarget = 'email') {
426426
const commitMap = await fetchCommitsForOpenPRs(openPRs, githubToken, numCommits);
427427
// Attach commits to PR objects
428428
openPRs.forEach(pr => {
429-
pr._lastCommits = commitMap[pr.number] || [];
429+
pr._allCommits = commitMap[pr.number] || [];
430+
pr._lastCommits = pr._allCommits.slice(0, numCommits);
430431
});
431432
}
432433
}
@@ -808,6 +809,7 @@ ${userReason}`;
808809
} else if (item.state === 'open') {
809810
li = `<li><i>(${project})</i> - Made PR (#${number}) - <a href='${html_url}'>${title}</a> ${pr_unmerged_button}`;
810811
if (showCommits && item._lastCommits && item._lastCommits.length) {
812+
item._lastCommits = item._allCommits.slice(0, numCommits);
811813
item._lastCommits.forEach(commit => {
812814
li += `<li style="list-style: disc; margin: 0 0 0 20px; padding: 0; color: #666;"><span style="color:#2563eb;">${commit.messageHeadline}</span><span style="color:#666; font-size: 11px;"> (${commit.author?.user?.login || commit.author?.name || 'unknown'}, ${new Date(commit.committedDate).toLocaleString()})</span></li>`;
813815
});

0 commit comments

Comments
 (0)