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

            return(UserTasks);
        }
Ejemplo 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);
        }
Ejemplo n.º 3
0
        public new List <TaskStatistic> GetStatisticData(DateTime startTime, DateTime finishTime)
        {
            List <TaskStatistic> statistics = new List <TaskStatistic>();

            var sessions = MockDataService.CreateStatisticData(5, 10, startTime, finishTime);

            foreach (var session in sessions)
            {
                if (session.Day >= startTime && session.Day <= finishTime)
                {
                    if (session.FinishedTaskInfo != null)
                    {
                        statistics.AddRange(session.FinishedTaskInfo);
                    }
                }
            }

            return(statistics);
        }