[Bug] Holiday import applies every region's holidays to everyone in the country (e.g. Scottish and NI holidays for English staff)
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 38/100
Research direction
Start with chaotica_utils/views/holidays.py and inspect the holiday lookup methods, especially HolidayManager.get_date_list(). Trace how Holiday.subdivs is populated and how user country data reaches both lookup sites; the issue suggests several possible fixes, including adding a user subdivision field. Done means regional holidays are limited to applicable users and the country filter works as intended.
Written by the indexing model from the issue text.
Description
Summary
holiday_import_lib (chaotica_utils/views/holidays.py) imports holidays for every subdivision of the chosen country and stores them with country set and the subdivision codes in Holiday.subdivs. But nothing reads subdivs: users have no subdivision field, and both places that look up a user's holidays filter by country only:
Holiday.objects.filter(Q(country=self.country) | Q(country__isnull=True), ...)
Importing United Kingdom therefore marks these as holidays for every GB user:
- 2 January
- St Patrick's Day
- Battle of the Boyne
- St Andrew's Day
- the Scottish summer bank holiday
This lowers effective working days and skews utilisation, availability and the scheduler for staff in England and Wales. The same applies to any country with regional holidays, such as Germany, Spain or Australia.
Related problems in the same code
- The country filter is discarded:
HolidayManager.get_date_list()callsmatches.filter(country=country)without assigning the result, so it returns holidays for every country. - Only two years are imported: the importer covers the current and next year (
years = [now.year, now.year + 1]), so admins must remember to re-run it every year. A note on the page, or a yearly task, would help.
Suggested fix
- Add
subdivisionto the user, for example aCharFieldvalidated againstholidays.country_holidays(country).subdivisions. Then filterQ(subdivs=[]) | Q(subdivs__contains=[user.subdivision])alongside the country. - Or let the importer take a subdivision, and import only the national holidays plus that region's.
- Fix
get_date_listto assign the filtered queryset.
- Dominant language
- HTML
- Stars
- 6
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from brainthee/CHAOTICA
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
[Minor UI Bug] Client page shows account manager photos as squares overlapping the round borderOpen
Difficulty 1/5 Under an hour Newbie friendliness 94/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
All issues in brainthee/CHAOTICA
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
aws/aws-emulator#30 · 1 comment ·
-
tormach-plasma refusal text with no machine reads "no machine is not declared a plasma machine"Openarea:post bug effort:low P2 source:agent
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
bug good first issue priority: P2 status: ready
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
RhinoLink-Tech/data-fabric#502 ·
Maintainers usually reply within 1 day
-
dropIndexes by key pattern panics on a shorter pattern and drops the wrong index on a longer oneOpen
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
mega-yfue/ha-eufy-sdk-bridge#198 ·
Maintainers usually reply within 1 day