Skip to content

Commit 10b5a5e

Browse files
committed
changed title in issues and PRs
Signed-off-by: Vedansh Saini <[email protected]>
1 parent bcb16c8 commit 10b5a5e

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

src/scripts/scrumHelper.js

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,8 +1417,14 @@ ${userReason}`;
14171417
startDateFilter = new Date(lastWeek.toISOString().split('T')[0] + 'T00:00:00Z');
14181418
endDateFilter = new Date(today.toISOString().split('T')[0] + 'T23:59:59Z');
14191419
}
1420+
1421+
const today = new Date();
1422+
today.setHours(0,0,0,0);
1423+
const itemCreatedDate = new Date(item.created_at);
1424+
itemCreatedDate.setHours(0,0,0,0);
1425+
const isCreatedToday = today.getTime() === itemCreatedDate.getTime();
14201426

1421-
const isNewPR = prCreatedDate >= startDateFilter && prCreatedDate <= endDateFilter;
1427+
const isNewPR = prCreatedDate == new Date();
14221428
const prUpdatedDate = new Date(item.updated_at);
14231429
const isUpdatedInRange = prUpdatedDate >= startDateFilter && prUpdatedDate <= endDateFilter;
14241430

@@ -1439,10 +1445,10 @@ ${userReason}`;
14391445
continue;
14401446
}
14411447
}
1442-
prAction = isNewPR ? 'Made PR' : 'Existing PR';
1448+
prAction = isNewPR ? 'Made PR' : 'Updated PR';
14431449
log(`[PR DEBUG] Including PR #${number} as ${prAction}`);
14441450
} else if (platform === 'gitlab') {
1445-
prAction = isNewPR ? 'Made Merge Request' : 'Existing Merge Request';
1451+
prAction = isNewPR ? 'Made Merge Request' : 'Updated Merge Request';
14461452
}
14471453

14481454
if (isDraft) {
@@ -1507,25 +1513,31 @@ ${userReason}`;
15071513
nextWeekArray.push(li2);
15081514
}
15091515

1516+
const today = new Date();
1517+
today.setHours(0,0,0,0);
1518+
const itemCreatedDate = new Date(item.created_at);
1519+
itemCreatedDate.setHours(0,0,0,0);
1520+
const isCreatedToday = today.getTime() === itemCreatedDate.getTime();
1521+
const issueActionText = isCreatedToday ? 'Opened Issue' : 'Updated Issue'
15101522
if (item.state === 'open') {
1511-
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a>${showOpenLabel ? ' ' + issue_opened_button : ''}</li>`;
1523+
li = `<li><i>(${project})</i> - ${issueActionText}(#${number}) - <a href='${html_url}'>${title}</a>${showOpenLabel ? ' ' + issue_opened_button : ''}</li>`;
15121524

15131525
} else if (item.state === 'closed') {
15141526

15151527

15161528
// Use state_reason to distinguish closure reason
15171529
if (item.state_reason === 'completed') {
1518-
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_completed_button}</li>`;
1530+
li = `<li><i>(${project})</i> - ${issueActionText}(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_completed_button}</li>`;
15191531
} else if (item.state_reason === 'not_planned') {
1520-
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_notplanned_button}</li>`;
1532+
li = `<li><i>(${project})</i> - ${issueActionText}(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_notplanned_button}</li>`;
15211533
} else {
1522-
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_button}</li>`;
1534+
li = `<li><i>(${project})</i> - ${issueActionText}(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_button}</li>`;
15231535
}
15241536

15251537

15261538
} else {
15271539
// Fallback for unexpected state
1528-
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a></li>`;
1540+
li = `<li><i>(${project})</i> - ${issueActionText}(#${number}) - <a href='${html_url}'>${title}</a></li>`;
15291541
}
15301542

15311543
log('[SCRUM-DEBUG] Added issue to lastWeekArray:', li, item);

0 commit comments

Comments
 (0)