Commit d2e030a8 authored by Ermolaev Timur's avatar Ermolaev Timur

#148 Пофиксил баг с дедлайном, он не возникает при создание задачи в календарях

parent eb22fe70
......@@ -27,7 +27,7 @@ router.get('/', async(req:Request, res:Response):Promise<Response> => {
/**create new task for table MyTask*/
router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
const {user,title,description,project,executor,dateTimeStart,dateTimeDue, dateTimeDeadLine,priority} = req.body;
const {user,title,description,project,executor,dateTimeStart,dateTimeDue, dateTimeDeadLine,priority, calendar} = req.body;
console.log('dateTimeStart \n', dateTimeStart, "dateTimeDue\n", dateTimeDue, 'dateTimeDeadLine\n ', dateTimeDeadLine)
let dateTimeDueFinal = dateTimeDue
let dateTimeStartFinal = dateTimeStart
......@@ -96,7 +96,7 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
}
newTask.priority = priority;
await newTask.save();
if (dateTimeDeadlineFinal) {
if (calendar) {
const newDateTimeTask = new DateTimeTask();
newDateTimeTask.dateTimeStart = dateTimeStartFinal
newDateTimeTask.dateTimeDue = dateTimeDueFinal
......
......@@ -198,7 +198,7 @@ function MonthCalendar() {
dateTimeDue: due,
executor: userId,
author: user.id,
dateTimeDeadLine: due,
calendar: true,
}
delete newTask.infoForCell
delete newTask.id
......
......@@ -20,7 +20,7 @@ function WeekCalendar() {
const { calendarTasks, copyMode } = useSelector(state => state.tasks);
const { user, currentCalendarDisplayName } = useSelector(state => state.users);
const { allUserProjects } = useSelector(state => state.projects)
console.log(copyMode)
const [weekGoal, setWeekGoal] = useState('Наладить режим сна')
const [weekPriorities, setWeekPriorities] = useState({ priorityOne: 'Один', priorityTwo: 'Два', priorityThree: 'Три' })
const [workerInfo, setWorkerInfo] = useState({ project: '', worker: '' });
......@@ -31,7 +31,7 @@ function WeekCalendar() {
const [userCalendarId, setUserCalendarId] = useState(null)
const [modal, setModal] = useState(false)
const [userId, setUserId] = useState('')
console.log(copyTask)
useEffect(() => {
const year = new Date().getFullYear()
const month = new Date().getMonth()
......@@ -196,7 +196,7 @@ function WeekCalendar() {
dateTimeDue: due,
executor: userId,
author: user.id,
dateTimeDeadLine: due,
calendar: true,
}
delete newTask.infoForCell
delete newTask.id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment