Skip to content

Commit

Permalink
UIPFU-77 - cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Terala-Priyanka committed Jan 10, 2024
1 parent e5287a2 commit a7bba68
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 40 deletions.
2 changes: 1 addition & 1 deletion src/UserSearchView.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class UserSearchView extends React.Component {

const getContentData = () => {
const activeFilterState = activeFilters?.state;
const isUasFilterGroupActive = {}.hasOwnProperty.call(activeFilterState, UAS);
const isUasFilterGroupActive = Object.hasOwn(activeFilterState, UAS);
const uasFilterValue = activeFilterState.uas;

if (isUasFilterGroupActive && uasFilterValue.length === 1) {
Expand Down
39 changes: 0 additions & 39 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,45 +65,6 @@ const filterUsersList = (filterString, initialSelectedUsers, users, filterCheck)
export const getUsersBasedOnAssignmentStatus = (activeFilterState, uasFilterValue, initialSelectedUsers, users) => {
const condForOneOfTheFilters = (u) => activeFilterState?.active?.includes(u.active ? `${ACTIVE}` : `${INACTIVE}`) || activeFilterState?.pg?.includes(u.patronGroup);
const condForBothTheFilters = (u) => activeFilterState?.active?.includes(u.active ? `${ACTIVE}` : `${INACTIVE}`) && activeFilterState?.pg?.includes(u.patronGroup);
// if (uasFilterValue[0] === `${ASSIGNED}`) {
// // when ONLY "Assigned" filter is selected
// const assignedUsers = Object.values(initialSelectedUsers);
// if (Object.keys(activeFilterState).length === 1) {
// return assignedUsers;
// }
// // several filters are selected
// // filter users based on the filter group values in place

// // when "Assigned" from "User Assignment Status" filter group along with some other filter in one of the other filter groups
// if (Object.keys(activeFilterState).length === 2) {
// const filteredAssignedUsers = assignedUsers.filter(u => condForOneOfTheFilters(u));
// return filteredAssignedUsers;
// }

// // when filters from all the filter groups are selected
// const filteredAssignedUsers = assignedUsers.filter(u => condForBothTheFilters(u));
// return filteredAssignedUsers;
// }
// if (uasFilterValue[0] === `${UNASSIGNED}`) {
// // when ONLY "Unassigned" filter is selected
// const assignedUserIds = Object.keys(initialSelectedUsers);
// if (Object.keys(activeFilterState).length === 1) {
// const filteredUsers = users.filter(u => !assignedUserIds.includes(u.id));
// return filteredUsers;
// }
// // several filters are selected
// // filter users based on the filter group values in place

// // when "UnAssigned" from "User Assignment Status" filter group along with some other filter in one of the other filter groups
// if (Object.keys(activeFilterState).length === 2) {
// const filteredAssignedUsers = users.filter(u => !assignedUserIds.includes(u.id) && (condForOneOfTheFilters(u)));
// return filteredAssignedUsers;
// }

// // when filters from all the filter groups are selected
// const filteredAssignedUsers = users.filter(u => !assignedUserIds.includes(u.id) && (condForBothTheFilters(u)));
// return filteredAssignedUsers;
// }

let usersList;
if (Object.keys(activeFilterState).length === 1) {
Expand Down

0 comments on commit a7bba68

Please sign in to comment.