update the json-server file to incorporate "valid" card data, tied to the users.

This commit is contained in:
chris.watts90@outlook.com 2017-01-29 22:46:05 +00:00
parent 532ed16bbd
commit 904ec01118

View File

@ -1,8 +1,17 @@
module.exports = function(){
var fakeTimeDataCount = 4000, maxUserCount = 120, unassignedCardCount = 4;
var fakeTimeDataCount = 4000, maxUserCount = 120, unassignedCardCount = 4, maxValidCardCount = 150;
var faker = require("faker");
var _ = require("lodash");
var directions = ["in", "out"];
var validCards = _.times(maxValidCardCount, function(n){
return{
id:n,
Id:n,
UserId_FK: faker.random.number(maxUserCount),
IsSelected: true,
CardUId: faker.random.uuid()
};
});
var usersData = _.times(maxUserCount, function (n)
{
return {
@ -11,7 +20,9 @@ module.exports = function(){
UserId: n,
FirstName: faker.name.firstName(),
LastName: faker.name.lastName(),
HoursPerWeek: 37.0
HoursPerWeek: 37.0,
AssociatedCardCount: _.filter(validCards, {'UserId_FK': n}).length,
AssociatedCards: _.filter(validCards, {'UserId_FK': n})
}
}
);