Skip to content

fix: fetch holiday list of an employee based on month end date filter…#4199

Merged
asmitahase merged 2 commits intofrappe:developfrom
aerele:roster-month-week-off
Mar 11, 2026
Merged

fix: fetch holiday list of an employee based on month end date filter…#4199
asmitahase merged 2 commits intofrappe:developfrom
aerele:roster-month-week-off

Conversation

@sudarsan2001
Copy link

@sudarsan2001 sudarsan2001 commented Mar 6, 2026

Issue Ref: 61990

Issue Description: When assigning multiple Holiday Lists with different weekend configurations to the same employee, the system incorrectly updates past roster entries based on the latest assignment.

Before:
hla-emp1
before-fix-roster

After:
after-fix-roster

backport needed in v15

Summary by CodeRabbit

  • Chores
    • Internal adjustment to how holiday lists are resolved (uses month-end as the reference date).
    • No changes to public APIs or user-facing behavior; existing holiday collection and grouping remain unchanged.

@l0gesh29 l0gesh29 force-pushed the roster-month-week-off branch from 2f46be1 to 32b2192 Compare March 6, 2026 06:59
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e504cc7b-0b9c-470f-b936-f8eb22295760

📥 Commits

Reviewing files that changed from the base of the PR and between 32b2192 and a00f691.

📒 Files selected for processing (1)
  • hrms/api/roster.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • hrms/api/roster.py

Walkthrough

The change updates the get_holidays function in hrms/api/roster.py to call get_holiday_list_for_employee with an additional as_on=month_end argument (the call is written as a multi-line conditional). The reference date used for resolving an employee’s holiday list is thus changed; the surrounding logic for collecting and grouping holidays is unchanged and no public API signatures were modified.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fetching holiday lists based on month-end date filtering, which directly addresses the core fix for the roster assignment bug.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
hrms/api/roster.py (1)

199-210: ⚠️ Potential issue | 🟠 Major

month_end still applies the wrong holiday list for mid-month reassignments.

This fixes the old “use today’s assignment” behavior, but it still resolves only one holiday list for the entire month. In hrms/utils/holiday_list.py:119-139, get_assigned_holiday_list returns the latest assignment whose from_date <= as_on, so if an employee switches lists on January 16, 2026, rendering January 2026 with as_on=2026-01-31 will still apply the January 16 list to January 1-15. Please resolve holiday lists per effective-date range within [month_start, month_end] and add a regression test for an in-month holiday-list change.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@hrms/api/roster.py` around lines 199 - 210, The loop in roster.py uses
get_holiday_list_for_employee(as_on=month_end) and applies one holiday_list for
the whole month, which misapplies mid-month reassignments; change the logic to
resolve holiday list assignments per effective-date range inside [month_start,
month_end] (e.g., obtain all holiday-list assignments for the employee that
overlap the month, iterate each assignment range, fetch holidays for that
assignment constrained to the assignment start/end intersected with
month_start/month_end, and append/merge into holidays[employee]);
update/introduce a regression test that creates an employee with a holiday-list
change mid-month (assignment before and another from mid-month) and asserts
holidays for the first half come from the first list and second half from the
second. Use function names/vars get_holiday_list_for_employee, month_start,
month_end, holiday_lists, holidays to locate and replace the single-as_on lookup
with per-range resolution and per-range queries.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@hrms/api/roster.py`:
- Around line 199-210: The loop in roster.py uses
get_holiday_list_for_employee(as_on=month_end) and applies one holiday_list for
the whole month, which misapplies mid-month reassignments; change the logic to
resolve holiday list assignments per effective-date range inside [month_start,
month_end] (e.g., obtain all holiday-list assignments for the employee that
overlap the month, iterate each assignment range, fetch holidays for that
assignment constrained to the assignment start/end intersected with
month_start/month_end, and append/merge into holidays[employee]);
update/introduce a regression test that creates an employee with a holiday-list
change mid-month (assignment before and another from mid-month) and asserts
holidays for the first half come from the first list and second half from the
second. Use function names/vars get_holiday_list_for_employee, month_start,
month_end, holiday_lists, holidays to locate and replace the single-as_on lookup
with per-range resolution and per-range queries.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 16a22cea-4e6b-474b-aafc-566bd3851ca7

📥 Commits

Reviewing files that changed from the base of the PR and between 9301ccf and 32b2192.

📒 Files selected for processing (1)
  • hrms/api/roster.py

@nareshkannasln nareshkannasln force-pushed the roster-month-week-off branch from 32b2192 to a00f691 Compare March 10, 2026 07:48
@asmitahase asmitahase merged commit ecfbd4d into frappe:develop Mar 11, 2026
7 checks passed
@asmitahase asmitahase deleted the roster-month-week-off branch March 11, 2026 10:20
asmitahase added a commit that referenced this pull request Mar 11, 2026
…4199

fix: fetch holiday list of an employee based on month end date filter… (backport #4199)
asmitahase added a commit that referenced this pull request Mar 11, 2026
…4199

fix: fetch holiday list of an employee based on month end date filter… (backport #4199)
asmitahase added a commit that referenced this pull request Mar 12, 2026
asmitahase added a commit that referenced this pull request Mar 12, 2026
…5-hotfix/pr-4199

fix: fetch holiday list of an employee based on month end date filter… (backport #4199)"
dandax123 pushed a commit to ASATechnologies/hrms that referenced this pull request Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants