-
Notifications
You must be signed in to change notification settings - Fork 35
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
(MODULES-10893) Fix Last Day Of Month Trigger #175
(MODULES-10893) Fix Last Day Of Month Trigger #175
Conversation
5f24243
to
a59945d
Compare
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.
Just one minor issue, but overall looks good 👍
Thanks for picking this up and addressing - took some work off my plate today 😃
a59945d
to
f870e90
Compare
d1538e0
to
7039ecf
Compare
Codecov Report
@@ Coverage Diff @@
## main #175 +/- ##
==========================================
+ Coverage 94.97% 95.02% +0.04%
==========================================
Files 6 6
Lines 836 844 +8
==========================================
+ Hits 794 802 +8
Misses 42 42
Continue to review full report at Codecov.
|
682314c
to
5995d0e
Compare
1ec8c87
to
1133c06
Compare
Prior to this change, attempting to create a trigger that will run on the last day of each selected month will fail. The error claims that a a value is out of range ``` OLE error code:0 in <Unknown> <No Description> HRESULT error code:0x8002000a Out of present range. ``` Microsoft [documentation] claims in one place that the correct way to specify the last day of a month is to effectively translate a bitmask value of day 32 and pass that into the `{get:set}_DaysOfMonth` method on the trigger object. The module was previously coded to do exactly this. The provider and it's helpers would catch the string value 'last' in the `on` property of a `monthly` trigger and translate it into the bit mask. This is what resulted in the error, because it turns out that the position for day 32 in the bit mast is outside the acceptable range of values for this property. This PR changes strategy and instead relies on a different section of the documentation in which an entirely different property on the trigger object called [RunOnLastDayOfMonth] is set. The code now catches the string value 'last' in the `on` property of the trigger, and sets this boolean on the trigger object. Testing has shown this to be an effective method of managing this property of a trigger. [documentation]: https://docs.microsoft.com/en-gb/windows/win32/api/taskschd/nf-taskschd-imonthlytrigger-get_daysofmonth [RunOnLastDayOfMonth]: https://docs.microsoft.com/en-gb/windows/win32/api/taskschd/nf-taskschd-imonthlytrigger-put_runonlastdayofmonth
1133c06
to
779908b
Compare
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.
Excellent, thanks for this @RandomNoun7 👍
Prior to this change, attempting to create a trigger that will run on
the last day of each selected month will fail. The error claims that a
a value is out of range
Microsoft documentation claims in one place that the correct way to
specify the last day of a month is to effectively translate a bitmask
value of day 32 and pass that into the
{get:set}_DaysOfMonth
methodon the trigger object. The module was previously coded to do exactly
this. The provider and it's helpers would catch the string value 'last'
in the
on
property of amonthly
trigger and translate it into thebit mask. This is what resulted in the error, because it turns out that
the position for day 32 in the bit mast is outside the acceptable range
of values for this property.
This PR changes strategy and instead relies on a different section
of the documentation in which an entirely different property on the
trigger object called RunOnLastDayOfMonth is set.
The code now catches the string value 'last' in the
on
property ofthe trigger, and sets this boolean on the trigger object.
Testing has shown this to be an effective method of managing this
property of a trigger.