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

PCHR-4110: Fix calendar feeds leave requests inclusion logic #2823

Merged
merged 1 commit into from
Aug 15, 2018

Conversation

igorpavlov-zz
Copy link
Contributor

@igorpavlov-zz igorpavlov-zz commented Aug 14, 2018

Overview

This PR fixes an issue when some leave requests are not included in a calendar feed due to their "from" and "to" dates.

The table below shows which leave requests were expected to be added but were not added.

              TODAY     +3 MONTHS           NOW    EXP    BUG
    ------------|-----------|------------    
LR1   +++++++                                X      X
LR2          +++++++                         X      V     YES
LR3                +++++++                   V      V
LR4                      +++++++             X      V     YES
LR6                            +++++++       X      X
LR7   ++++++++++++++++++++++++++++++++       X      V     YES

Technical Details

Logically wise the date selection was wrong, the correct logic is:

Whenever at least one day of a leave request appears in the period [TODAY - TODAY+3MONTHS] - include it.

private function getLeaveRequests() {
  $params = [
    // ...
    'from_date' => ['<=' => $this->endDate->format('Y-m-d H:i:s')],
    'to_date' => ['>=' => $this->startDate->format('Y-m-d H:i:s')]
  ];

  $result = civicrm_api3('LeaveRequest', 'get', $params);

  // ...
}

✅Manual Tests - passed
⏹Jasmine Tests - not needed
⏹JS distributive files - not needed
⏹CSS distributive files - not needed
⏹Backstop tests - not needed
✅PHP Unit Tests - amended and passed

@igorpavlov-zz igorpavlov-zz force-pushed the PCHR-4110-fix-calendar-feeds-lr-inclusion branch from 3b5d066 to 11ecf68 Compare August 14, 2018 15:46
Copy link
Contributor

@ajesamson ajesamson left a comment

Choose a reason for hiding this comment

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

Approved 👌

@igorpavlov-zz igorpavlov-zz merged commit bdd8389 into staging Aug 15, 2018
@igorpavlov-zz igorpavlov-zz deleted the PCHR-4110-fix-calendar-feeds-lr-inclusion branch August 15, 2018 09:33
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.

3 participants