-
Notifications
You must be signed in to change notification settings - Fork 91
Fix issue labeling: solved opened and updated issues #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1507,25 +1507,51 @@ ${userReason}`; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
nextWeekArray.push(li2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Determine if issue was created or updated in date range | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const issueCreatedDate = new Date(item.created_at); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Get the correct date range for filtering | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
let startDateFilter, endDateFilter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (yesterdayContribution) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const today = new Date(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const yesterday = new Date(today.getTime() - 24 * 60 * 60 * 1000); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
startDateFilter = new Date(yesterday.toISOString().split('T')[0] + 'T00:00:00Z'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
endDateFilter = new Date(today.toISOString().split('T')[0] + 'T23:59:59Z'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} else if (startingDate && endingDate) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
startDateFilter = new Date(startingDate + 'T00:00:00Z'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
endDateFilter = new Date(endingDate + 'T23:59:59Z'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Default to last 7 days if no date range is set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const today = new Date(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const lastWeek = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 7); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
startDateFilter = new Date(lastWeek.toISOString().split('T')[0] + 'T00:00:00Z'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
endDateFilter = new Date(today.toISOString().split('T')[0] + 'T23:59:59Z'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (bug_risk): Date construction using string manipulation may introduce timezone inconsistencies. This approach may cause bugs when local dates cross midnight or during daylight saving changes. Use UTC-based methods or a date library for consistent results.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const isNewIssue = issueCreatedDate >= startDateFilter && issueCreatedDate <= endDateFilter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const issueAction = isNewIssue ? 'Opened Issue' : 'Updated Issue'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
log(`[ISSUE DEBUG] Issue #${number} - isNewIssue: ${isNewIssue}, issueAction: ${issueAction}, state: ${item.state}, created: ${item.created_at}, updated: ${item.updated_at}`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Consider removing or gating debug logging for production environments. Debug logs in production can expose sensitive data and create unnecessary noise. If these logs are only needed for development, use a conditional or appropriate logging level to prevent them from appearing in production.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (item.state === 'open') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a>${showOpenLabel ? ' ' + issue_opened_button : ''}</li>`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
li = `<li><i>(${project})</i> - ${issueAction}(#${number}) - <a href='${html_url}'>${title}</a>${showOpenLabel ? ' ' + issue_opened_button : ''}</li>`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} else if (item.state === 'closed') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Use state_reason to distinguish closure reason | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (item.state_reason === 'completed') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_completed_button}</li>`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
li = `<li><i>(${project})</i> - ${issueAction}(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_completed_button}</li>`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} else if (item.state_reason === 'not_planned') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_notplanned_button}</li>`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
li = `<li><i>(${project})</i> - ${issueAction}(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_notplanned_button}</li>`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_button}</li>`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
li = `<li><i>(${project})</i> - ${issueAction}(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_button}</li>`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Fallback for unexpected state | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a></li>`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
li = `<li><i>(${project})</i> - ${issueAction}(#${number}) - <a href='${html_url}'>${title}</a></li>`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
log('[SCRUM-DEBUG] Added issue to lastWeekArray:', li, item); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): Subtracting days using Date constructor can yield unexpected results at month boundaries.
Date arithmetic using the Date constructor can fail at month boundaries. Use getTime() subtraction for consistent results.