Skip to content

Commit

Permalink
feat: ASAP-397 Inactive team Working Group and Interest Group partici…
Browse files Browse the repository at this point in the history
…pation (#4222)
  • Loading branch information
peterstarling authored Apr 2, 2024
1 parent 7b41a89 commit a3d674f
Show file tree
Hide file tree
Showing 2 changed files with 354 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,24 @@ export class AnalyticsContentfulDataProvider implements AnalyticsDataProvider {
.map((team) => ({
id: team.sys.id,
displayName: team.displayName || '',
interestGroupLeadershipRoleCount: getUniqueIdCount(
team.linkedFrom?.teamMembershipCollection?.items.flatMap(
(teamMembershipItem) =>
teamMembershipItem?.linkedFrom?.usersCollection?.items
.flatMap(flattenInterestGroupLeaders)
.filter(
(item) =>
item.interestGroupActive && item.userIsAlumni === false,
)
.map((item) => item.interestGroupId),
) || [],
),
interestGroupMemberCount:
(!team.inactiveSince &&
getUniqueIdCount([
interestGroupLeadershipRoleCount: team.inactiveSince
? 0
: getUniqueIdCount(
team.linkedFrom?.teamMembershipCollection?.items.flatMap(
(teamMembershipItem) =>
teamMembershipItem?.linkedFrom?.usersCollection?.items
.flatMap(flattenInterestGroupLeaders)
.filter(
(item) =>
item.interestGroupActive &&
item.userIsAlumni === false,
)
.map((item) => item.interestGroupId),
) || [],
),
interestGroupMemberCount: team.inactiveSince
? 0
: getUniqueIdCount([
...(team.linkedFrom?.teamMembershipCollection?.items.flatMap(
(teamMembershipItem) =>
teamMembershipItem?.linkedFrom?.usersCollection?.items
Expand All @@ -61,19 +64,31 @@ export class AnalyticsContentfulDataProvider implements AnalyticsDataProvider {
...(team.linkedFrom?.interestGroupsCollection?.items
.filter((interestGroup) => !!interestGroup?.active)
.flatMap((interestGroup) => interestGroup?.sys.id) || []),
])) ||
0,
interestGroupPreviousLeadershipRoleCount: getUniqueIdCount(
team.linkedFrom?.teamMembershipCollection?.items.flatMap(
]),
interestGroupPreviousLeadershipRoleCount: getUniqueIdCount([
...(team.linkedFrom?.teamMembershipCollection?.items.flatMap(
(teamMembershipItem) =>
teamMembershipItem?.linkedFrom?.usersCollection?.items
.flatMap(flattenInterestGroupLeaders)
.filter(
(item) => !item.interestGroupActive || item.userIsAlumni,
)
.map((item) => item.interestGroupId),
) || [],
),
) || []),
...((team.inactiveSince &&
team.linkedFrom?.teamMembershipCollection?.items.flatMap(
(teamMembershipItem) =>
teamMembershipItem?.linkedFrom?.usersCollection?.items
.flatMap(flattenInterestGroupLeaders)
.filter(
(item) =>
item.interestGroupActive &&
item.userIsAlumni === false,
)
.map((item) => item.interestGroupId),
)) ||
[]),
]),
interestGroupPreviousMemberCount: getUniqueIdCount([
...(team.linkedFrom?.teamMembershipCollection?.items.flatMap(
(teamMembershipItem) =>
Expand All @@ -94,38 +109,58 @@ export class AnalyticsContentfulDataProvider implements AnalyticsDataProvider {
)
.flatMap((interestGroup) => interestGroup?.sys.id) || []),
]),
workingGroupLeadershipRoleCount: getUniqueIdCount(
team.linkedFrom?.teamMembershipCollection?.items.flatMap(
(teamMembershipItem) =>
teamMembershipItem?.linkedFrom?.usersCollection?.items
.filter(filterOutAlumni)
.flatMap(flattenWorkingGroupLeaders),
) || [],
),
workingGroupMemberCount: getUniqueIdCount(
team.linkedFrom?.teamMembershipCollection?.items.flatMap(
(teamMembershipItem) =>
teamMembershipItem?.linkedFrom?.usersCollection?.items
.filter(filterOutAlumni)
.flatMap(flattenWorkingGroupMember),
) || [],
),
workingGroupPreviousLeadershipRoleCount: getUniqueIdCount(
team.linkedFrom?.teamMembershipCollection?.items.flatMap(
workingGroupLeadershipRoleCount: team.inactiveSince
? 0
: getUniqueIdCount(
team.linkedFrom?.teamMembershipCollection?.items.flatMap(
(teamMembershipItem) =>
teamMembershipItem?.linkedFrom?.usersCollection?.items
.filter(filterOutAlumni)
.flatMap(flattenWorkingGroupLeaders),
) || [],
),
workingGroupMemberCount: team.inactiveSince
? 0
: getUniqueIdCount(
team.linkedFrom?.teamMembershipCollection?.items.flatMap(
(teamMembershipItem) =>
teamMembershipItem?.linkedFrom?.usersCollection?.items
.filter(filterOutAlumni)
.flatMap(flattenWorkingGroupMember),
) || [],
),
workingGroupPreviousLeadershipRoleCount: getUniqueIdCount([
...((team.inactiveSince &&
team.linkedFrom?.teamMembershipCollection?.items.flatMap(
(teamMembershipItem) =>
teamMembershipItem?.linkedFrom?.usersCollection?.items
.filter(filterOutAlumni)
.flatMap(flattenWorkingGroupLeaders),
)) ||
[]),
...(team.linkedFrom?.teamMembershipCollection?.items.flatMap(
(teamMembershipItem) =>
teamMembershipItem?.linkedFrom?.usersCollection?.items
.filter(filterAlumni)
.flatMap(flattenWorkingGroupLeaders),
) || [],
),
workingGroupPreviousMemberCount: getUniqueIdCount(
team.linkedFrom?.teamMembershipCollection?.items.flatMap(
) || []),
]),
workingGroupPreviousMemberCount: getUniqueIdCount([
...((team.inactiveSince &&
team.linkedFrom?.teamMembershipCollection?.items.flatMap(
(teamMembershipItem) =>
teamMembershipItem?.linkedFrom?.usersCollection?.items
.filter(filterOutAlumni)
.flatMap(flattenWorkingGroupMember),
)) ||
[]),
...(team.linkedFrom?.teamMembershipCollection?.items.flatMap(
(teamMembershipItem) =>
teamMembershipItem?.linkedFrom?.usersCollection?.items
.filter(filterAlumni)
.flatMap(flattenWorkingGroupMember),
) || [],
),
) || []),
]),
})) || [],
};
}
Expand Down
Loading

0 comments on commit a3d674f

Please sign in to comment.