updated file to generate testcard data.

updated userstest endpoint to return the usercount parameter.
This commit is contained in:
chris.watts90@outlook.com 2017-01-29 15:25:47 +00:00
parent 430f91ce18
commit b7492479c9

View File

@ -1,16 +1,17 @@
module.exports = function(){
var fakeTimeDataCount = 4000, maxUserCount = 120;
var fakeTimeDataCount = 4000, maxUserCount = 120, unassignedCardCount = 4;
var faker = require("faker");
var _ = require("lodash");
var directions = ["in", "out"];
var usersData = _.times(maxUserCount, function (n)
{
return {
id: n,
//timestamp: faker.date.past(),
userId: n,
firstName: faker.name.firstName(),
lastName: faker.name.lastName()
id: n, //needed for the /users/id endpoint
Id: n,
UserId: n,
FirstName: faker.name.firstName(),
LastName: faker.name.lastName(),
HoursPerWeek: 37.0
}
}
);
@ -18,22 +19,38 @@ module.exports = function(){
{
return {
id: n,
userId: faker.random.number(maxUserCount),
timestamp: faker.date.past(),
direction: directions[faker.random.number(1)]
Id: n,
UserId: faker.random.number(maxUserCount),
Timestamp: faker.date.past(),
Direction: directions[faker.random.number(1)]
}
}
}
);
var userDataObject = {users: _.orderBy(usersData, ["lastName", "firstName"],["asc", "asc"])};
);
//var userDataObject = {users: _.orderBy(usersData, ["lastName", "firstName"],["asc", "asc"])};
var unassignedTestCards = _.times(unassignedCardCount, function(n)
{
return {
id: n,
Id: n,
UserId: -1,
IsSelected: false, //needed for knockout checked binding.
CardUId: faker.random.uuid()
}
});
return {
userSwipeData: _.orderBy(userSwipeDataPoints, ["id"], ["asc"]),
timelogs: _.orderBy(userSwipeDataPoints, ["id"], ["asc"]),
//users: _.orderBy(data, ["userId", "asc"]),
users: _.orderBy(usersData, ["lastName", "firstName"],["asc", "asc"]),
//weather: _.orderBy(data, ["timestamp"],["asc"]),
stats: _.countBy(userSwipeDataPoints, "userId"),
timelogtest: {
Logs: _.orderBy(userSwipeDataPoints, "Timestamp", "asc")
},
userstest: {
users: _.orderBy(usersData, ["lastName", "firstName"],["asc", "asc"])
}
UserCount: maxUserCount,
Users: _.orderBy(usersData, ["lastName", "firstName"],["asc", "asc"])
},
unassignedCards: { data: unassignedTestCards}
}
}
/*