#136 added fixture dates imporve for deadlines and defalut project in new task…

#136 added fixture dates imporve for deadlines and defalut project in new task form tbl workers tasks
parent b4ccd170
...@@ -100,11 +100,13 @@ const loadFixtures = async () => { ...@@ -100,11 +100,13 @@ const loadFixtures = async () => {
for (let i = 0; i < 20; i++) { for (let i = 0; i < 20; i++) {
let dateOfMonth = randomIntFromInterval(20, 30) let currnetTime = new Date()
let startdateOfMonth = randomIntFromInterval(20, 24)
let enddateOfMonth = randomIntFromInterval(25, 29)
let deadLineDateOfMonth = randomIntFromInterval(1, 10) let deadLineDateOfMonth = randomIntFromInterval(1, 10)
let startDateTime = new Date(2022, 10, dateOfMonth, randomIntFromInterval(16, 21), 0, 0); let startDateTime = new Date(currnetTime.getFullYear(), currnetTime.getMonth()+1,startdateOfMonth , randomIntFromInterval(16, 21), 0, 0);
let dueDateTime = new Date(2022, 10, dateOfMonth, randomIntFromInterval(22, 22), 0, 0); let dueDateTime = new Date(currnetTime.getFullYear(), currnetTime.getMonth()+1,enddateOfMonth, randomIntFromInterval(22, 22), 0, 0);
let deadLine = new Date(2022, 11, deadLineDateOfMonth, 0, 0, 0); let deadLine = new Date(currnetTime.getFullYear(), currnetTime.getMonth()+2, deadLineDateOfMonth, randomIntFromInterval(20, 22), 0, 0);
const newDateTimeTask= new DateTimeTask() const newDateTimeTask= new DateTimeTask()
newDateTimeTask.dateTimeStart=startDateTime; newDateTimeTask.dateTimeStart=startDateTime;
newDateTimeTask.dateTimeDue=dueDateTime; newDateTimeTask.dateTimeDue=dueDateTime;
......
...@@ -28,6 +28,7 @@ router.get('/', async(req:Request, res:Response):Promise<Response> => { ...@@ -28,6 +28,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} = req.body;
console.log('dateTimeStart \n', dateTimeStart, "dateTimeDue\n", dateTimeDue, 'dateTimeDeadLine\n ', dateTimeDeadLine)
let dateTimeDueFinal = dateTimeDue let dateTimeDueFinal = dateTimeDue
let dateTimeStartFinal = dateTimeStart let dateTimeStartFinal = dateTimeStart
let dateTimeDeadlineFinal= dateTimeDeadLine let dateTimeDeadlineFinal= dateTimeDeadLine
...@@ -112,6 +113,7 @@ router.post('/users', auth, async(req:Request, res:Response):Promise<Response>=> ...@@ -112,6 +113,7 @@ router.post('/users', auth, async(req:Request, res:Response):Promise<Response>=>
const newTask = new Task(); const newTask = new Task();
newTask.title = title; newTask.title = title;
newTask.description = description; newTask.description = description;
const currentTime = new Date();
if (project) { if (project) {
const watcherOfProject = await dataSource const watcherOfProject = await dataSource
.getRepository(Project) .getRepository(Project)
......
...@@ -40,7 +40,7 @@ export default function NewTaskForm({ ...@@ -40,7 +40,7 @@ export default function NewTaskForm({
dateTimeDeadLine: null, dateTimeDeadLine: null,
dateTimeTasks: [], dateTimeTasks: [],
dateTimeDue: null, dateTimeDue: null,
project: null, project: projects?projects.find(project=>project.title==="Не определено"):null,
accomplish: "opened", accomplish: "opened",
priority: "B", priority: "B",
author: { id: user.id }, author: { id: user.id },
...@@ -49,7 +49,6 @@ export default function NewTaskForm({ ...@@ -49,7 +49,6 @@ export default function NewTaskForm({
isEditMode: true, isEditMode: true,
}); });
const [modal, setModal] = useState(false); const [modal, setModal] = useState(false);
console.log('NewTaskForm currentProject ', currentProject )
const onModalOpen = (event, task) => { const onModalOpen = (event, task) => {
event.stopPropagation(); event.stopPropagation();
......
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