diff --git a/scrum_helper b/scrum_helper
new file mode 160000
index 0000000..518de01
--- /dev/null
+++ b/scrum_helper
@@ -0,0 +1 @@
+Subproject commit 518de0137fea7dddc32168b8667cb80c2daf1c3b
diff --git a/src/scripts/scrumHelper.js b/src/scripts/scrumHelper.js
index ce0bfbf..3b04435 100644
--- a/src/scripts/scrumHelper.js
+++ b/src/scripts/scrumHelper.js
@@ -932,7 +932,7 @@ ${userReason}`;
let pr_arr = githubPrsReviewDataProcessed[repo][pr];
let prText = '';
prText +=
- "#" + pr_arr.number + ' (' + pr_arr.title + ') ';
+ "#" + pr_arr.number + ' (' + pr_arr.title +
if (showOpenLabel && pr_arr.state === 'open') prText += issue_opened_button;
// Do not show closed label for reviewed PRs
prText += ' ';
@@ -1056,6 +1056,7 @@ ${userReason}`;
}
for (let i = 0; i < items.length; i++) {
+
let item = items[i];
let html_url = item.html_url;
let repository_url = item.repository_url;
@@ -1074,77 +1075,76 @@ ${userReason}`;
const endDate = new Date(endingDate + 'T23:59:59');
const isNewPR = prCreatedDate >= startDate && prCreatedDate <= endDate;
- if (!isNewPR) {
- const hasCommitsInRange = showCommits && item._allCommits && item._allCommits.length > 0;
-
- if (!hasCommitsInRange) {
- continue; //skip these prs - created outside daterange with no commits
- } else { }
- } else { }
- const prAction = isNewPR ? 'Made PR' : 'Existing PR';
- if (isDraft) {
- li = `
(${project}) - Made PR (#${number}) - ${title}${showOpenLabel ? ' ' + pr_draft_button : ''}`;
- } else if (item.state === 'open') {
- li = `(${project}) - ${prAction} (#${number}) - ${title}${showOpenLabel ? ' ' + pr_open_button : ''}`;
- if (showCommits && item._allCommits && item._allCommits.length && !isNewPR) {
- log(`[PR DEBUG] Rendering commits for existing PR #${number}:`, item._allCommits);
- item._allCommits.forEach(commit => {
- li += `${commit.messageHeadline} (${new Date(commit.committedDate).toLocaleString()})`;
- });
- }
- li += ``;
- } else if (item.state === 'closed') {
- let merged = null;
- if ((githubToken || (useMergedStatus && !fallbackToSimple)) && mergedStatusResults) {
- let repoParts = repository_url.split('/');
- let owner = repoParts[repoParts.length - 2];
- let repo = repoParts[repoParts.length - 1];
- merged = mergedStatusResults[`${owner}/${repo}#${number}`];
- }
- if (merged === true) {
- li = `(${project}) - Made PR (#${number}) - ${title}${showOpenLabel ? ' ' + pr_merged_button : ''}`;
- } else {
- li = `(${project}) - Made PR (#${number}) - ${title}${showOpenLabel ? ' ' + pr_closed_button : ''}`;
- }
- }
- lastWeekArray.push(li);
- continue; // Prevent issue logic from overwriting PR li
+ if (item.pull_request) {
+ const prCreatedDate = new Date(item.created_at);
+ const startDate = new Date(startingDate);
+ const endDate = new Date(endingDate + 'T23:59:59');
+ const isNewPR = prCreatedDate >= startDate && prCreatedDate <= endDate;
+ if (!isNewPR) {
+ const hasCommitsInRange = showCommits && item._allCommits && item._allCommits.length > 0;
+ if (!hasCommitsInRange) {
+ continue; // Skip PRs created outside the date range with no commits
+ }
+ }
+
+ const prAction = isNewPR ? 'Made PR' : 'Existing PR';
+
+ // 🟤 Draft PR
+ if (isDraft) {
+ li = `(${project}) - ${prAction} (#${number}) - ${title} ${pr_draft_button}`;
+
+ // 🟢 Open PR
+ } else if (item.state === 'open') {
+ li = `(${project}) - ${prAction} (#${number}) - ${title} ${pr_open_button}`;
+ if (showCommits && item._allCommits && item._allCommits.length && !isNewPR) {
+ log(`[PR DEBUG] Rendering commits for existing PR #${number}:`, item._allCommits);
+ item._allCommits.forEach(commit => {
+ li += `
+ ${commit.messageHeadline}
+ (${new Date(commit.committedDate).toLocaleString()})
+ `;
+ });
+ }
+ li += ``;
+
+ // 🔴 Closed PR (check if merged or not)
+ } else if (item.state === 'closed') {
+ const isMerged = item.merged_at !== null && item.merged_at !== undefined;
+
+ if (isMerged) {
+ // Merged PR: no label shown
+ li = `(${project}) - ${prAction} (#${number}) - ${title}`;
} else {
- // Only process as issue if not a PR
- if (item.state === 'open' && item.body?.toUpperCase().indexOf('YES') > 0) {
- let li2 =
- '(' +
- project +
- ') - Work on Issue(#' +
- number +
- ") - " +
- title +
- '' + (showOpenLabel ? ' ' + issue_opened_button : '') +
- ' ';
- nextWeekArray.push(li2);
- }
- if (item.state === 'open') {
- li = `(${project}) - Opened Issue(#${number}) - ${title}${showOpenLabel ? ' ' + issue_opened_button : ''}`;
- } else if (item.state === 'closed') {
- // Always show closed label for closed issues
- li = `(${project}) - Opened Issue(#${number}) - ${title}${showOpenLabel ? ' ' + issue_closed_button : ''}`;
- } else {
- li =
- '(' +
- project +
- ') - Opened Issue(#' +
- number +
- ") - " +
- title +
- ' ';
- }
- lastWeekArray.push(li);
+ // Closed but not merged: no label either
+ li = `(${project}) - ${prAction} (#${number}) - ${title}`;
}
- issuesDataProcessed = true;
+ }
+
+ lastWeekArray.push(li);
+ continue;
+
+ } else {
+ // 📌 It's an Issue
+ if (item.state === 'open' && item.body?.toUpperCase().indexOf('YES') > 0) {
+ let li2 =
+ `(${project}) - Work on Issue(#${number}) - ${title} ${issue_opened_button}`;
+ nextWeekArray.push(li2);
+ }
+
+ if (item.state === 'open') {
+ li = `(${project}) - Opened Issue(#${number}) - ${title} ${issue_opened_button}`;
+ } else if (item.state === 'closed') {
+ li = `(${project}) - Opened Issue(#${number}) - ${title} `;
+ } else {
+ li = `(${project}) - Opened Issue(#${number}) - ${title}`;
+ }
+
+ lastWeekArray.push(li);
+ }
+}
+issuesDataProcessed = true;
+ if (outputTarget === 'email') {
+ triggerScrumGeneration();
}
let intervalBody = setInterval(() => {