Esempio n. 1
0
        public List <UserTask> GetAllUserTask(AplicationUser user)
        {
            for (int i = 0; i < 100; i++)
            {
                UserTasks.Add(MockDataService.CreateUserTask());
            }

            return(UserTasks);
        }
Esempio n. 2
0
        public static List <PomodoroSession> CreateStatisticData(int taskCount, int dailypomodoroCount, DateTime startTime, DateTime finishTime)
        {
            List <PomodoroSession> sessions   = new List <PomodoroSession>();
            List <TaskStatistic>   statistics = new List <TaskStatistic>();
            var userTasks = new List <UserTask>();

            for (int i = 0; i < 100; i++)
            {
                userTasks.Add(MockDataService.CreateUserTask());
            }

            var dayCount = (finishTime - startTime).TotalDays;

            var r          = new Random();
            int startCount = dailypomodoroCount / 2;

            for (int d = 0; d < dayCount; d++)
            {
                var session = new PomodoroSession()
                {
                    Day = startTime.AddDays(d), Id = Guid.NewGuid()
                };
                for (int i = 0; i < startCount; i++)
                {
                    var           taskIndex = new Random().Next() % userTasks.Count;
                    TaskStatistic s         = new TaskStatistic();
                    s.Duration     = TimeSpan.FromMinutes(20);
                    s.Id           = Guid.NewGuid();
                    s.TaskId       = userTasks[taskIndex].Id;
                    s.TaskName     = userTasks[taskIndex].TaskName;
                    s.FinishedTime = startTime.AddDays(d);
                    session.FinishedTaskInfo.Add(s);
                }

                if (startCount > dailypomodoroCount)
                {
                    startCount = dailypomodoroCount / 2;
                }
                startCount++;
                sessions.Add(session);
            }

            return(sessions);
        }