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> => { ...@@ -27,7 +27,7 @@ router.get('/', async(req:Request, res:Response):Promise<Response> => {
/**create new task for table MyTask*/ /**create new task for table MyTask*/
router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{ 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) console.log('dateTimeStart \n', dateTimeStart, "dateTimeDue\n", dateTimeDue, 'dateTimeDeadLine\n ', dateTimeDeadLine)
let dateTimeDueFinal = dateTimeDue let dateTimeDueFinal = dateTimeDue
let dateTimeStartFinal = dateTimeStart let dateTimeStartFinal = dateTimeStart
...@@ -96,7 +96,7 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{ ...@@ -96,7 +96,7 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
} }
newTask.priority = priority; newTask.priority = priority;
await newTask.save(); await newTask.save();
if (dateTimeDeadlineFinal) { if (calendar) {
const newDateTimeTask = new DateTimeTask(); const newDateTimeTask = new DateTimeTask();
newDateTimeTask.dateTimeStart = dateTimeStartFinal newDateTimeTask.dateTimeStart = dateTimeStartFinal
newDateTimeTask.dateTimeDue = dateTimeDueFinal newDateTimeTask.dateTimeDue = dateTimeDueFinal
......
...@@ -198,7 +198,7 @@ function MonthCalendar() { ...@@ -198,7 +198,7 @@ function MonthCalendar() {
dateTimeDue: due, dateTimeDue: due,
executor: userId, executor: userId,
author: user.id, author: user.id,
dateTimeDeadLine: due, calendar: true,
} }
delete newTask.infoForCell delete newTask.infoForCell
delete newTask.id delete newTask.id
......
...@@ -20,7 +20,7 @@ function WeekCalendar() { ...@@ -20,7 +20,7 @@ function WeekCalendar() {
const { calendarTasks, copyMode } = useSelector(state => state.tasks); const { calendarTasks, copyMode } = useSelector(state => state.tasks);
const { user, currentCalendarDisplayName } = useSelector(state => state.users); const { user, currentCalendarDisplayName } = useSelector(state => state.users);
const { allUserProjects } = useSelector(state => state.projects) const { allUserProjects } = useSelector(state => state.projects)
console.log(copyMode)
const [weekGoal, setWeekGoal] = useState('Наладить режим сна') const [weekGoal, setWeekGoal] = useState('Наладить режим сна')
const [weekPriorities, setWeekPriorities] = useState({ priorityOne: 'Один', priorityTwo: 'Два', priorityThree: 'Три' }) const [weekPriorities, setWeekPriorities] = useState({ priorityOne: 'Один', priorityTwo: 'Два', priorityThree: 'Три' })
const [workerInfo, setWorkerInfo] = useState({ project: '', worker: '' }); const [workerInfo, setWorkerInfo] = useState({ project: '', worker: '' });
...@@ -31,7 +31,7 @@ function WeekCalendar() { ...@@ -31,7 +31,7 @@ function WeekCalendar() {
const [userCalendarId, setUserCalendarId] = useState(null) const [userCalendarId, setUserCalendarId] = useState(null)
const [modal, setModal] = useState(false) const [modal, setModal] = useState(false)
const [userId, setUserId] = useState('') const [userId, setUserId] = useState('')
console.log(copyTask)
useEffect(() => { useEffect(() => {
const year = new Date().getFullYear() const year = new Date().getFullYear()
const month = new Date().getMonth() const month = new Date().getMonth()
...@@ -196,7 +196,7 @@ function WeekCalendar() { ...@@ -196,7 +196,7 @@ function WeekCalendar() {
dateTimeDue: due, dateTimeDue: due,
executor: userId, executor: userId,
author: user.id, author: user.id,
dateTimeDeadLine: due, calendar: true,
} }
delete newTask.infoForCell delete newTask.infoForCell
delete newTask.id 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