#69 fix fixtures

parent 296994dc
...@@ -8,11 +8,12 @@ import { Member, MemberRole } from "./models/Member"; ...@@ -8,11 +8,12 @@ import { Member, MemberRole } from "./models/Member";
import { DateTimeTask } from "./models/DateTimeTask"; import { DateTimeTask } from "./models/DateTimeTask";
function randomIntFromInterval(min:number, max:number) { function randomIntFromInterval(min:number, max:number) {
return Math.floor(Math.random() * (max - min + 1) + min) min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min) + min);
} }
let countUsers = 0
let countMembers =0 let countMembers =0
let countProjects = 0
let countRolesProject=0 let countRolesProject=0
const cycleThroughObject=(countKey:number,objectObserve:any):MemberRole=>{ const cycleThroughObject=(countKey:number,objectObserve:any):MemberRole=>{
...@@ -35,15 +36,6 @@ const cycleArrayOfMembers=(countIndex:number, members:Member[]):Member=>{ ...@@ -35,15 +36,6 @@ const cycleArrayOfMembers=(countIndex:number, members:Member[]):Member=>{
} }
const cycleArrayOfProjects=(countIndex:number, projects:Project[]):Project=>{
let project = projects[countIndex]
countIndex++
if (countIndex ===projects.length-1){
countIndex=0
}
return project
}
const loadFixtures = async () => { const loadFixtures = async () => {
myDataSource myDataSource
.initialize() .initialize()
...@@ -86,10 +78,10 @@ const loadFixtures = async () => { ...@@ -86,10 +78,10 @@ const loadFixtures = async () => {
for (let i = 0; i < 20; i++) { for (let i = 0; i < 20; i++) {
let dateOfMonth = randomIntFromInterval(20, 30) let dateOfMonth = randomIntFromInterval(20, 30)
let deadLineDateOfMonth = randomIntFromInterval(1, 15) let deadLineDateOfMonth = randomIntFromInterval(1, 10)
let startDateTime = new Date(2022, 11, dateOfMonth, randomIntFromInterval(10, 15), 0, 0); let startDateTime = new Date(2022, 10, dateOfMonth, randomIntFromInterval(16, 21), 0, 0);
let dueDateTime = new Date(2022, 11, dateOfMonth, randomIntFromInterval(16, 20), 0, 0); let dueDateTime = new Date(2022, 10, dateOfMonth, randomIntFromInterval(22, 22), 0, 0);
let deadLine = new Date(2022, 12, deadLineDateOfMonth, 0, 0, 0); let deadLine = new Date(2022, 11, deadLineDateOfMonth, 0, 0, 0);
const newDateTimeTask= new DateTimeTask() const newDateTimeTask= new DateTimeTask()
newDateTimeTask.dateTimeStart=startDateTime; newDateTimeTask.dateTimeStart=startDateTime;
newDateTimeTask.dateTimeDue=dueDateTime; newDateTimeTask.dateTimeDue=dueDateTime;
......
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