Skip to content
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

Add substituted holidays for Australia #201

Merged
merged 8 commits into from
Apr 29, 2020

Conversation

c960657
Copy link
Contributor

@c960657 c960657 commented Jan 15, 2020

Fixes #199.

I don't know anything about Australian holidays, but perhaps @jbroudou can verify this?

Basically we now mark both the original holiday and the substitute holiday as TYPE_OFFICIAL holidays. This applies to all holidays which are moved to the following Monday.

@stelgenhof stelgenhof added this to the v2.3.0 milestone Jan 16, 2020
@jbroudou
Copy link

Hi,

Is this applied to all Australian holidays?

Not all holidays in Australia have the condition where if the public holiday falls on a Sunday, then both the Sunday and Monday are holidays. It depends on the holiday and state.

Ideally you would set the BOTH condition (i.e. Sunday and Monday) on by default for all holidays, but then have a flag where you can switch it off so that the Monday is the only holiday.

@c960657
Copy link
Contributor Author

c960657 commented Jan 18, 2020

This PR does not change which holidays are moved to Mondays. Whether each holiday should be moved is specified by two boolean arguments for calculateHoliday(..., $moveFromSaturday, $moveFromSunday, ...).

What this PR does is that if a holiday is moved from a Saturday or Sunday to a Monday, the original holiday on Saturday/Sunday will be marked in addition to the holiday on Monday. The two days will be labeled e.g. “Australia Day” and “Australia Day observed”, respectively.

@stelgenhof
Copy link
Member

In addition to @c960657 comment, just wanted to confirm that the 'business' rules whether a holiday is being substituted lies already with each individual holiday. In some other countries, holiday substitution applies to all holidays so a more generic logic/code is applied.

@stelgenhof
Copy link
Member

@c960657 Would you mind having a look at my comments? Thanks!

@c960657
Copy link
Contributor Author

c960657 commented Feb 16, 2020

Sure, I'll take a look next week.

@github-actions
Copy link

This pull request has been open 60 days with no activity. Please remove the stale label or comment, or this will be closed in 10 days.

@c960657
Copy link
Contributor Author

c960657 commented Apr 18, 2020

Sorry for not responding to this sooner.

I have added an assertion on the holiday type for the subsituted holidays.

It is true that calculateHoliday() is used elsewhere, but only Australia Day uses the substitute holiday logic. Either it is called with false, false, meaning that no substitution should happen, or it is called with holidays that always fall on e.g. a Tuesday. This is why no other tests were failing after my changes. So I went ahead and replaced all these calls to calculateHoliday() with addHoliday().

Also, I removed a bunch of unused asserts. If we just asserted that $foo is an instance of Holiday, we don't need to assert that it is not null.

@stelgenhof
Copy link
Member

@c960657 It's looking good, however can you again look at my comments? There could be an additional check for the SubstituteHoliday instance in the tests.

@c960657
Copy link
Contributor Author

c960657 commented Apr 29, 2020

I added assertSubstituteHoliday(). This asserts that the holiday is the right subclass. Doesn't this address your comment, or did you mean something else?

@stelgenhof
Copy link
Member

@c960657 Yes, thank you! I missed that the code was changed :) There are now some conflicts. Could you check these? Then I will merge the PR.

@c960657
Copy link
Contributor Author

c960657 commented Apr 29, 2020

Done :)

Copy link
Member

@stelgenhof stelgenhof left a comment

Choose a reason for hiding this comment

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

Thanks! Looking good.

@stelgenhof stelgenhof merged commit 8d6e103 into azuyalabs:develop Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Date addition (Australia Day Subdivision: AU-SA / Year: 2020)
3 participants