-
Notifications
You must be signed in to change notification settings - Fork 0
networkdays, networkdays.intl #33
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
networkdays, networkdays.intl #33
Conversation
|
cursor review |
|
cursor review |
|
bugbot run cursor review |
|
bugbot run cursor 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.
✅ BugBot reviewed your changes and found no bugs!
Was this report helpful? Give feedback by reacting with 👍 or 👎
Resolved conflicts by keeping our working implementation while incorporating the test files and documentation from the PR.
Consolidated duplicate helper functions introduced across PRs #35, #36, #41, #33: ✅ **Holiday/Date Array Processing**: - Merged get_holiday_set() (PR #41) and get_array_of_dates() (PR #33) - New: process_date_array() - unified date array processing - New: dates_to_holiday_set() - converter for backward compatibility - Removed ~100 lines of duplicate code ✅ **Weekend Pattern Processing**: - Merged weekend_from_arg() (PR #41) and parse_weekend_pattern() (PR #33) - New: parse_weekend_pattern_unified() - consolidated weekend parsing - Legacy wrapper: weekend_from_arg() for backward compatibility - Handles both numeric codes (1-7, 11-17) and string patterns ("0110000") **Impact**: Reduced code duplication by ~200 lines while maintaining full functionality **Functions using consolidated helpers**: WORKDAY, WORKDAY.INTL, NETWORKDAYS, NETWORKDAYS.INTL
Found and eliminated the biggest remaining duplication pattern from PRs #35, #36, #41, #33: ✅ **Date Validation Pattern** (29+ occurrences → consolidated): - Old: Repeated `from_excel_date` + identical error handling in every function - New: `validate_and_convert_date_serial()` - single source of truth - New: `get_and_validate_date_serial()` - handles common get_number + validate pattern **Functions Updated** (examples): - fn_weekday: 9 lines → 3 lines - fn_weeknum: 9 lines → 3 lines - fn_workday: 9 lines → 3 lines **Potential Impact**: - 29+ functions with identical 9-line patterns can now use 3-line helpers - Estimated savings: ~180 lines of duplicate code - Single location for date validation logic changes - Consistent error handling across all date functions **Pattern Eliminated**: \`\`\`rust // Before (repeated 29+ times): let serial = match self.get_number(&args[0], cell) { ... }; let date = match from_excel_date(serial) { Ok(d) => d, Err(_) => return CalcResult::Error { ... } }; // After (reusable helper): let (_serial, date) = match self.get_and_validate_date_serial(&args[0], cell) { ... }; \`\`\`
|
Consolidating into #50. |
Summary
NETWORKDAYSandNETWORKDAYS.INTLimplementationsTesting
cargo test -p ironcalc_base --lib --quiethttps://chatgpt.com/codex/tasks/task_e_68658c30afb08327965806a8efd37bd1