Improvements on start button
This commit is contained in:
@@ -1,15 +1,29 @@
|
||||
import moment from "moment";
|
||||
import {Assignment} from "@/interfaces/results";
|
||||
|
||||
export const futureAssignmentFilter = (a: Assignment) => {
|
||||
if(a.archived) return false;
|
||||
if(a.start) return false;
|
||||
// export const futureAssignmentFilter = (a: Assignment) => {
|
||||
// if(a.archived) return false;
|
||||
// if(a.start) return false;
|
||||
|
||||
// const currentDate = moment();
|
||||
// const startDate = moment(a.startDate);
|
||||
// if(currentDate.isAfter(startDate)) return false;
|
||||
// if(a.autoStart && a.autoStartDate) {
|
||||
// return moment(a.autoStartDate).isAfter(currentDate);
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
export const futureAssignmentFilter = (a: Assignment) => {
|
||||
const currentDate = moment();
|
||||
const startDate = moment(a.startDate);
|
||||
if(startDate.isAfter(currentDate)) return true;
|
||||
if(a.autoStart && a.autoStartDate) {
|
||||
return moment(a.autoStartDate).isAfter(currentDate);
|
||||
if(moment(a.endDate).isBefore(currentDate)) return false;
|
||||
if(a.archived) return false;
|
||||
|
||||
if(a.autoStart && a.autoStartDate && moment(a.autoStartDate).isBefore(currentDate)) return false;
|
||||
|
||||
if(!a.start) {
|
||||
if(moment(a.startDate).isBefore(currentDate)) return false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -36,16 +50,28 @@ export const activeAssignmentFilter = (a: Assignment) => {
|
||||
return moment(a.autoStartDate).isBefore(currentDate);
|
||||
}
|
||||
|
||||
// if(currentDate.isAfter(moment(a.startDate))) return true;
|
||||
return false;
|
||||
};
|
||||
|
||||
export const unstartedAssignmentFilter = (a: Assignment) => {
|
||||
// export const unstartedAssignmentFilter = (a: Assignment) => {
|
||||
// const currentDate = moment();
|
||||
// if(moment(a.endDate).isBefore(currentDate)) return false;
|
||||
// if(a.archived) return false;
|
||||
|
||||
// if(a.autoStart && a.autoStartDate && moment(a.autoStartDate).isBefore(currentDate)) return false;
|
||||
|
||||
// if(!a.start) {
|
||||
// if(moment(a.startDate).isBefore(currentDate)) return false;
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
export const startHasExpiredAssignmentFilter = (a: Assignment) => {
|
||||
const currentDate = moment();
|
||||
if(moment(a.endDate).isBefore(currentDate)) return false;
|
||||
if(a.archived) return false;
|
||||
|
||||
if(a.autoStart && a.autoStartDate && moment(a.autoStartDate).isBefore(currentDate)) return false;
|
||||
|
||||
if(!a.start) return true;
|
||||
if(a.start) return false;
|
||||
if(currentDate.isAfter(moment(a.startDate)) && currentDate.isBefore(moment(a.endDate))) return true;
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user