Skip to content

Commit

Permalink
format the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Behzad-rabiei committed Mar 5, 2024
1 parent c27901e commit f4e6596
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/services/memberActivity.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1015,26 +1015,26 @@ async function getMembersInteractionsNetworkGraph(
const rolesInNetworkGraph = usersInfo.flatMap((user) => user.roles);
const roles = await roleService.getRoles(guildConnection, { roleId: { $in: rolesInNetworkGraph } });

// prepare data
const response = usersInteractions.flatMap((interaction) => {
const { aUserId, bUserId, rWeeklyInteraction } = interaction
// Radius
const aUserRadiusObj = userRadius.find((userRadius) => userRadius.userId == aUserId)
const aUserRadius = aUserRadiusObj?.radius as number
const bUserRadiusObj = userRadius.find((userRadius) => userRadius.userId == bUserId)
const bUserRadius = bUserRadiusObj?.radius as number
// Status
const aUserStatsObj = userStatus.find((userStatus) => userStatus.userId == aUserId)
const aUserStats = aUserStatsObj?.stats
const bUserStatsObj = userStatus.find((userStatus) => userStatus.userId == bUserId)
const bUserStats = bUserStatsObj?.stats
// userInfo
const aUser = usersInfo.find(user => user.discordId === aUserId)
const bUser = usersInfo.find(user => user.discordId === bUserId)
if(!aUser || !bUser) return []

const aInfo = getUserInformationForNetworkGraph(aUser, roles)
const bInfo = getUserInformationForNetworkGraph(bUser, roles)
// prepare data
const response = usersInteractions.flatMap((interaction) => {
const { aUserId, bUserId, rWeeklyInteraction } = interaction;
// Radius
const aUserRadiusObj = userRadius.find((userRadius) => userRadius.userId == aUserId);
const aUserRadius = aUserRadiusObj?.radius as number;
const bUserRadiusObj = userRadius.find((userRadius) => userRadius.userId == bUserId);
const bUserRadius = bUserRadiusObj?.radius as number;
// Status
const aUserStatsObj = userStatus.find((userStatus) => userStatus.userId == aUserId);
const aUserStats = aUserStatsObj?.stats;
const bUserStatsObj = userStatus.find((userStatus) => userStatus.userId == bUserId);
const bUserStats = bUserStatsObj?.stats;
// userInfo
const aUser = usersInfo.find((user) => user.discordId === aUserId);
const bUser = usersInfo.find((user) => user.discordId === bUserId);
if (!aUser || !bUser) return [];

const aInfo = getUserInformationForNetworkGraph(aUser, roles);
const bInfo = getUserInformationForNetworkGraph(bUser, roles);

if (!aUserStats || !bUserStats) {
return [];
Expand Down

0 comments on commit f4e6596

Please sign in to comment.