-
Notifications
You must be signed in to change notification settings - Fork 89
Reviewed Prs Bug fixed #225
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
Conversation
Reviewer's GuideThis PR standardizes date handling across the app by replacing custom padding logic with ISO date strings, centralizes date‐range computation for caching and API queries, tightens commit and PR filtering using unified start/end dates with detailed logging, and cleans up date utilities in the UI scripts. Class diagram for updated date handling and PR filteringclassDiagram
class ScrumHelper {
+getYesterday()
+getToday()
+allIncluded(outputTarget)
+fetchCommitsForOpenPRs(prs, githubToken, startDate, endDate)
+filterReviewedPRs(items, dateRange)
}
class DateUtils {
+getYesterday()
+getToday()
}
class PRItem {
+number
+state
+created_at
+updated_at
+pull_request
+_allCommits
}
ScrumHelper --> DateUtils : uses
ScrumHelper --> PRItem : filters
class MainUI {
+getYesterday()
+getToday()
}
class PopupUI {
+getYesterday()
+getToday()
}
MainUI ..> DateUtils : similar logic
PopupUI ..> DateUtils : similar logic
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @Preeti9764 - I've reviewed your changes - here's some feedback:
- The repeated date‐range computation logic is duplicated in several places—extract it into a single helper to DRY up the code and ensure consistency.
- Subtracting 24h via getTime() - 246060*1000 can misbehave around DST transitions; consider using setDate(getDate() - 1) or handling dates in UTC consistently.
- The added verbose logging may flood production output—consider gating these debug statements behind a log level or feature flag.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The repeated date‐range computation logic is duplicated in several places—extract it into a single helper to DRY up the code and ensure consistency.
- Subtracting 24h via getTime() - 24*60*60*1000 can misbehave around DST transitions; consider using setDate(getDate() - 1) or handling dates in UTC consistently.
- The added verbose logging may flood production output—consider gating these debug statements behind a log level or feature flag.
## Individual Comments
### Comment 1
<location> `src/scripts/scrumHelper.js:341` </location>
<code_context>
- '-' +
- ('00' + yesterdayDay.toString()).slice(-2);
- return yesterdayPadded;
+ let yesterday = new Date(today.getTime() - 24 * 60 * 60 * 1000);
+ return yesterday.toISOString().split('T')[0];
}
</code_context>
<issue_to_address>
Subtracting 24 hours may not always yield the previous calendar day due to DST changes.
This approach can produce incorrect results around DST changes. Use a date library or `setDate(today.getDate() - 1)` for reliable calculation of the previous calendar day.
</issue_to_address>
### Comment 2
<location> `src/scripts/popup.js:16` </location>
<code_context>
- '-' +
- ('00' + yesterdayDay.toString()).slice(-2);
- return yesterdayPadded;
+ let yesterday = new Date(today.getTime() - 24 * 60 * 60 * 1000);
+ return yesterday.toISOString().split('T')[0];
}
</code_context>
<issue_to_address>
Date calculation and formatting for 'yesterday' may not be robust across timezones and DST.
This method may produce incorrect dates near DST transitions or for users outside UTC. Use a timezone-aware approach for accurate results.
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@hpdang Please review. |
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.
LGTM!
📌 Fixes
Fixes #224
📝 Summary of Changes
Summary by Sourcery
Fix the reviewed PR bug by standardizing date handling and strengthening PR filtering to only include items within the selected date range.
Bug Fixes:
Enhancements: