Skip to content

Commit

Permalink
adjust to yesterday
Browse files Browse the repository at this point in the history
  • Loading branch information
LomyW committed Jul 20, 2023
1 parent 31ee30b commit d4fad73
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions common/chat/contacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const getMatchContactsForUser = async (user: User): Promise<MatchContactStudent[
};
const getInstructorsForPupilSubcourses = async (pupil: User): Promise<SubcourseContactStudent[]> => {
assert(pupil.pupilId, 'Pupil must have an pupilId');
const today = moment().toISOString();
const yesterday = moment().subtract(1, 'day').toISOString();
const studentsWithSubcourseIds = await prisma.student.findMany({
where: {
subcourse_instructors_student: {
Expand All @@ -104,7 +104,7 @@ const getInstructorsForPupilSubcourses = async (pupil: User): Promise<SubcourseC
allowChatContactParticipants: true,
subcourse_participants_pupil: { some: { pupilId: pupil.pupilId } },
cancelled: false,
lecture: { some: { start: { gte: today } } },
lecture: { some: { start: { gte: yesterday } } },
},
},
},
Expand Down Expand Up @@ -141,7 +141,7 @@ const getInstructorsForPupilSubcourses = async (pupil: User): Promise<SubcourseC
};
const getSubcourseParticipantContactForUser = async (student: User): Promise<SubcourseContactPupil[]> => {
assert(student.studentId, 'Student must have an studentId');
const today = moment().toISOString();
const yesterday = moment().subtract(1, 'day').toISOString();

const pupilsWithSubcourseIds = await prisma.pupil.findMany({
where: {
Expand All @@ -151,7 +151,7 @@ const getSubcourseParticipantContactForUser = async (student: User): Promise<Sub
allowChatContactParticipants: true,
subcourse_instructors_student: { some: { studentId: student.studentId } },
cancelled: false,
lecture: { some: { start: { gte: today } } },
lecture: { some: { start: { gte: yesterday } } },
},
},
},
Expand Down

0 comments on commit d4fad73

Please sign in to comment.