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-3766: Fix Manager Leave for managers #2663

Conversation

reneolivo
Copy link
Member

@reneolivo reneolivo commented Jun 4, 2018

Overview

This PR fixes the following issues on Manager Leave:

  • It removes the managees types filter for managers.
  • It fixes the managees presented to the manager

Before

manager-leave-before

After

manager-leave-after
(manager has no staff assigned to them)

Technical Details

The issue was present because the filtering for contacts needed to change in order to show all contacts on My Leave.

// Before:
var filters = { ... };
var hasContactFilter = !!vm.filters.userSettings.contact;
var hasLookUpContactsFilter = _.isArray(vm.lookupContacts) && vm.lookupContacts.length;

if (hasContactFilter) {
  filters.id = { 'IN': [vm.filters.userSettings.contact.id] };
} else if (hasLookUpContactsFilter) {
  filters.id = { 'IN': _.pluck(vm.lookupContacts, 'id') };
}

// After:
var filters = { ... };
var hasContactFilter = !!vm.filters.userSettings.contact;
var hasLookUpContactsFilter = _.isArray(vm.lookupContacts) && vm.lookupContacts.length;
var notRequestingAllContacts = _.get(vm, 'filters.userSettings.assignedTo.type', 'all') !== 'all';

if (hasContactFilter) {
  filters.id = { 'IN': [vm.filters.userSettings.contact.id] };
} else if (notRequestingAllContacts || hasLookUpContactsFilter) {
  filters.id = { 'IN': _.pluck(vm.lookupContacts, 'id') };
}

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

@reneolivo reneolivo merged commit 4c1c4db into PCHR-3485-all-staff-leave-calendar Jun 4, 2018
@reneolivo reneolivo deleted the PCHR-3766-fix-manager-leave-for-managers branch June 4, 2018 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants