Skip to content

Commit

Permalink
Refactor: detectAbusingUsers.js
Browse files Browse the repository at this point in the history
  • Loading branch information
kmc7468 committed Feb 22, 2024
1 parent f40f8d3 commit 4995425
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/lottery/schedules/detectAbusingUsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,25 +134,24 @@ const detectLessChatUsers = async (period, candidateUserIds) => {
if (
period.startAt > room.time ||
period.endAt <= room.time ||
room.settlementTotal <= 0
room.settlementTotal === 0
)
return null;

const users = room.part
const parts = room.part
.map((part) => part.user)
.filter((userId) => candidateUserIds.some(equalsObjectId(userId)));
if (users.length <= 0) return null;
if (parts.length === 0) return null;

return {
roomId,
chatCount: count,
users,
parts,
};
})
);
const lessChatUserIds = removeObjectIdDuplicates(
lessChatRooms.reduce(
(array, day) => (day ? array.concat(day.users) : array),
(array, day) => (day ? array.concat(day.parts) : array),
[]
)
);
Expand Down

0 comments on commit 4995425

Please sign in to comment.