Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
planner-team-one
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
21
Issues
21
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Евгений Положенцев
planner-team-one
Commits
9d00e81b
Commit
9d00e81b
authored
Nov 09, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#17
Реализовал задачи в фикстуре
parent
402aad11
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
fixtures.ts
planner-api/src/fixtures.ts
+40
-2
tasksReducer.js
planner-front/src/store/reducers/tasksReducer.js
+2
-0
No files found.
planner-api/src/fixtures.ts
View file @
9d00e81b
...
...
@@ -40,7 +40,45 @@ Data Source has been initialized!
await
user
.
save
();
users
.
push
(
user
)
}
const
tasks
=
[]
type
taskFinishType
=
"opened"
|
"done"
|
"failed"
;
type
priorityType
=
"A"
|
"B"
|
"C"
;
const
priorities
:
priorityType
[]
=
[
"A"
,
"B"
,
"C"
]
const
accomplish
:
taskFinishType
[]
=
[
"opened"
,
"done"
,
"failed"
]
for
(
let
i
=
0
;
i
<
15
;
i
++
)
{
if
(
i
<=
10
)
{
const
newTask
=
new
Task
();
newTask
.
title
=
`Buy
${
faker
.
commerce
.
productName
()}
`
;
newTask
.
description
=
faker
.
random
.
words
(
4
);
newTask
.
executors
=
faker
.
helpers
.
arrayElements
(
users
,
randomIntFromInterval
(
0
,
3
));
newTask
.
dateTimeDue
=
faker
.
date
.
soon
(
randomIntFromInterval
(
1
,
15
));
newTask
.
dateTimeStart
=
faker
.
date
.
recent
((
randomIntFromInterval
(
0
,
8
)));
newTask
.
author
=
faker
.
helpers
.
arrayElement
(
users
);
newTask
.
accomplish
=
faker
.
helpers
.
arrayElement
(
accomplish
);
newTask
.
priority
=
faker
.
helpers
.
arrayElement
(
priorities
);
await
newTask
.
save
();
tasks
.
push
(
newTask
)
}
else
{
const
newTask
=
new
Task
();
newTask
.
title
=
`Buy
${
faker
.
commerce
.
productName
()}
`
;
newTask
.
description
=
faker
.
random
.
words
(
4
);
newTask
.
executors
=
faker
.
helpers
.
arrayElements
(
users
,
randomIntFromInterval
(
0
,
3
));
newTask
.
dateTimeDue
=
null
;
newTask
.
dateTimeStart
=
null
;
newTask
.
author
=
faker
.
helpers
.
arrayElement
(
users
);
newTask
.
accomplish
=
accomplish
[
0
];
newTask
.
priority
=
faker
.
helpers
.
arrayElement
(
priorities
);
await
newTask
.
save
();
tasks
.
push
(
newTask
)
}
}
console
.
log
(
`
==========================
Fixtures done!
==========================
`
)
})
...
...
planner-front/src/store/reducers/tasksReducer.js
View file @
9d00e81b
...
...
@@ -14,6 +14,7 @@ const tasksReduсer = (state = initialState, action) => {
const
newArr
=
[]
action
.
tasks
.
forEach
((
task
)
=>
{
if
(
task
.
dateTimeStart
&&
task
.
dateTimeDue
)
{
if
(
new
Date
(
task
.
dateTimeDue
).
getTime
()
-
new
Date
(
task
.
dateTimeStart
).
getTime
()
<
(
4
*
3600000
))
{
const
dateStart
=
task
.
dateTimeStart
.
split
(
'T'
)[
0
]
const
timeStart
=
task
.
dateTimeStart
.
split
(
'T'
)[
1
]
const
timeEnd
=
task
.
dateTimeDue
.
split
(
'T'
)[
1
]
...
...
@@ -35,6 +36,7 @@ const tasksReduсer = (state = initialState, action) => {
}
}
)
}
}
})
return
{...
state
,
loading
:
false
,
tasks
:
newArr
};
case
FETCH_TASKS_FAILURE
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment