Skip to content

Commit

Permalink
Merge pull request #184 from makeopensource/110-automate-start/end-dates
Browse files Browse the repository at this point in the history
removed assignment filter by start date from backend
  • Loading branch information
NeemZ16 authored Nov 6, 2024
2 parents 4b30f48 + de17ad5 commit c973ff5
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions devU-api/src/entities/assignment/assignment.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsNull, MoreThanOrEqual } from 'typeorm'
import { IsNull } from 'typeorm'
import { dataSource } from '../../database'

import AssignmentModel from './assignment.model'
Expand Down Expand Up @@ -64,22 +64,11 @@ export async function listByCourse(courseId: number) {
}

export async function listByCourseReleased(courseId: number) {
// filter by start date after current time
const now = new Date(Date.now())
const allAssignments = await connect().findBy({ courseId: courseId, startDate: MoreThanOrEqual(now), deletedAt: IsNull() })

console.log("ASSIGNMENTS WITH FILTER: ", allAssignments)

// for each assignment in allAssignments (a list), if the startDate is more than 3 days from now then add it to list releasedAssignments
// const now = new Date();
// const threeDaysFromNow = new Date();
// threeDaysFromNow.setDate(now.getDate() + 3);

// // Filter assignments where the startDate is within the next 3 days
// const releasedAssignments = allAssignments.filter(assignment => {
// const startDate = new Date(assignment.startDate);
// return startDate >= now && startDate <= threeDaysFromNow;
// });
// TODO: filter by start date after current time
// const now = new Date(Date.now())
const allAssignments = await connect().findBy({ courseId: courseId, /*startDate: MoreThanOrEqual(now),*/ deletedAt: IsNull() })

// console.log("ASSIGNMENTS WITH FILTER: ", allAssignments)

return allAssignments;
}
Expand Down

0 comments on commit c973ff5

Please sign in to comment.