Skip to content

Commit

Permalink
Fix: using undefined variable in checkIsAbusing function
Browse files Browse the repository at this point in the history
  • Loading branch information
kmc7468 committed Feb 22, 2024
1 parent 1a6e166 commit 3eda783
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/services/rooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const createHandler = async (req, res) => {
};

const checkIsAbusing = (
{ from, to, maxPartLength },
{ from, to, time, maxPartLength },
countRecentlyMadeRooms,
candidateRoomsByTime
) => {
Expand Down Expand Up @@ -146,7 +146,7 @@ const checkIsAbusing = (
let secondRoom = {
from,
to,
time: dateTime,
time: new Date(time),
maxPartLength,
};
if (secondRoom.time < firstRoom.time) {
Expand Down Expand Up @@ -203,7 +203,7 @@ const createTestHandler = async (req, res) => {
.sort({ time: 1 })
.limit(2)
.lean();
if (!candidateRoomsByTime && candidateRoomsByTime?.length !== 0)
if (!candidateRoomsByTime)
return res
.status(500)
.json({ error: "Rooms/create/test : internal server error" });
Expand Down

0 comments on commit 3eda783

Please sign in to comment.