-
Notifications
You must be signed in to change notification settings - Fork 274
Add option to exclude holidays from copilot metrics #234
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
Co-authored-by: karpikpl <[email protected]>
Co-authored-by: karpikpl <[email protected]>
Co-authored-by: karpikpl <[email protected]>
@copilot I want to set |
Co-authored-by: karpikpl <[email protected]>
I've added UI controls to the DateRangeSelector component for setting
Users can now set holiday exclusion directly from the Date Range Filter section without needing to modify URL parameters manually. Commit: efd65eb Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
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.
Pull Request Overview
This PR adds support for excluding holidays from Copilot metrics by leveraging the date-holidays
library and propagating new excludeHolidays
and locale
options through the API, model, and UI.
- Introduce holiday filtering in server-side metrics endpoints and mock data generation
- Extend
Options
model to includeexcludeHolidays
andlocale
, with serialization/deserialization and query handling - Update UI (
DateRangeSelector
,MainComponent
) to allow users to toggle holiday exclusion
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
File | Description |
---|---|
tests/weekends-filtering.spec.ts | Added weekend/holiday identification tests (contains debug logs) |
server/api/metrics.ts | Integrated holiday filtering, locale detection, caching key updated |
app/utils/dateUtils.ts | Implemented isHoliday , filterHolidaysFromMetrics , parseUtcDate |
app/components/DateRangeSelector.vue | UI checkbox for excluding holidays, event emission updated |
server/modules/authentication.ts | Adjusted mock detection logic in authentication flow |
export function isHoliday(date: Date, locale: string): boolean { | ||
try { | ||
if (isWeekend(date)) { | ||
return true; // Treat weekends as holidays | ||
} | ||
const holidays = new Holidays(locale); |
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.
[nitpick] Creating a new Holidays
instance on every call can be expensive; consider caching instances by locale outside of the filter loop.
export function isHoliday(date: Date, locale: string): boolean { | |
try { | |
if (isWeekend(date)) { | |
return true; // Treat weekends as holidays | |
} | |
const holidays = new Holidays(locale); | |
const holidaysCache = new Map<string, Holidays>(); | |
export function isHoliday(date: Date, locale: string): boolean { | |
try { | |
if (isWeekend(date)) { | |
return true; // Treat weekends as holidays | |
} | |
let holidays = holidaysCache.get(locale); | |
if (!holidays) { | |
holidays = new Holidays(locale); | |
holidaysCache.set(locale, holidays); | |
} |
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
This PR implements a new feature to exclude holidays from copilot metrics data, allowing users to filter out non-working days from their analysis.
Changes Made
1. Added Holiday Exclusion Support
date-holidays
package for accurate holiday detection across different localesexcludeHolidays
(boolean) andlocale
(string) to the Options classAccept-Language
header2. API Integration
excludeHolidays=true
to exclude holidays from resultslocale
parameter (e.g., 'US', 'DE', 'FR') to specify which country's holidays to exclude3. Implementation Details
server/api/metrics.ts
to filter out holidays from both real API responses and mock data generationupdateMockDataDates
function to skip holidays when generating date rangesfilterHolidaysFromMetrics
function to remove holiday entries from existing data4. Updated Options Class
5. Comprehensive Testing
date-holidays
libraryUsage Examples
Benefits
Fixes #233.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
api.fontshare.com
node (vitest)
(dns block)api.fontsource.org
node (vitest)
(dns block)fonts.bunny.net
node (vitest)
(dns block)fonts.google.com
node (vitest)
(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js
(dns block)fonts.googleapis.com
node (vitest 1)
(dns block)node (vitest 2)
(dns block)node (vitest 3)
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.