Beispiel #1
0
        private IEnumerable <StudentStatistics> GetStudentStatistics(List <Student> studentList, List <CodeCommit> commitList)
        {
            List <StudentStatistics> studentStatisticsList = new List <StudentStatistics>();
            int  commitNr      = 0;
            long modCodeLineNr = 0;
            StudentStatistics studStats;

            foreach (var student in studentList)
            {
                commitNr      = 0;
                modCodeLineNr = 0;

                foreach (var commit in commitList)
                {
                    if (student.Id.Equals(commit.UserId))
                    {
                        commitNr++;
                        modCodeLineNr = commit.LinesModified == null ? 0 : (long)commit.LinesModified;
                    }
                }

                studStats                    = new StudentStatistics();
                studStats.Student            = student;
                studStats.CommitNr           = commitNr;
                studStats.ModifiedCodeLineNr = modCodeLineNr;

                studentStatisticsList.Add(studStats);
            }

            return(studentStatisticsList);
        }
Beispiel #2
0
        public IEnumerable <StudentStatistics> Get()
        {
            var students    = GetAllStudentsAsync().Result;
            var codeCommits = GetAllCodeCommits().Result;

            List <StudentStatistics> studentStatisctics = new List <StudentStatistics>();

            for (int i = 0; i < students.Count(); i++)
            {
                var studentStatistic = new StudentStatistics();
                var element          = students.ElementAt(i);

                //studentStatistic = mapper.Map<Student>(students.ElementAt(i));
                studentStatistic.Id        = element.Id;
                studentStatistic.LastName  = element.LastName;
                studentStatistic.FirstName = element.FirstName;
                studentStatistic.Email     = element.Email;
                studentStatistic.Phone     = element.Phone;

                List <CodeCommit> codeCommitList = new List <CodeCommit>();
                int? numberOfCommits             = 0;
                long?codeLines = 0;
                for (int j = 0; j < codeCommits.Count(); j++)
                {
                    if (studentStatistic.Id == codeCommits.ElementAt(j).UserId)
                    {
                        numberOfCommits++;
                        codeLines += codeCommits.ElementAt(i).LinesModified;
                    }
                }
                studentStatistic.NumberOfCommits       = numberOfCommits > 0 ? numberOfCommits : null;
                studentStatistic.NumberOfModifiedLines = codeLines > 0 ? codeLines : null;

                studentStatisctics.Add(studentStatistic);
            }

            return(studentStatisctics);
        }
Beispiel #3
0
        public int GetStudentWithLargestGPASwing(List <StudentStatistics> studentData)
        {
            int studentId = -1;

            try
            {
                if (studentData != null && studentData.Any())
                {
                    StudentStatistics student = studentData.OrderByDescending(x => x.GPASwing).First();
                    studentId = student.Id;
                }
                else
                {
                    return(studentId);
                }
            }
            catch (Exception err)
            {
                Console.WriteLine(err.Message);
                return(studentId);
            }

            return(studentId);
        }
        private List <CircleDataViewModel> LoadStatisticsByType(string username, Types role)
        {
            BussinesLayer bl = new BussinesLayer(new FinalDB());
            List <CircleDataViewModel> circleList = new List <CircleDataViewModel>();

            if (role == Types.Student)
            {
                StudentStatistics statistics = bl.GetStudentStatistics(username);
                circleList.Add(new CircleDataViewModel()
                {
                    ID       = "quadrant1",
                    Title    = "בקשות שאושרו מתוך סך הבקשות",
                    Value    = this.GetPercent(statistics.Requests),
                    MaxValue = 100
                });

                circleList.Add(new CircleDataViewModel()
                {
                    ID       = "quadrant2",
                    Title    = "פגישות שאישרתי מתוך סך הפגישות",
                    Value    = this.GetPercent(statistics.Sessions),
                    MaxValue = 100
                });

                circleList.Add(new CircleDataViewModel()
                {
                    ID       = "quadrant3",
                    Title    = "בקשות שהוגשו מאותו הקורס",
                    Value    = this.GetPercent(statistics.CourseRequets),
                    MaxValue = 100
                });

                circleList.Add(new CircleDataViewModel()
                {
                    ID       = "quadrant4",
                    Title    = "ניצול השעות מתוך השעות המאושרות",
                    Value    = this.GetPercent(statistics.ApprovalHours),
                    MaxValue = 100
                });
            }
            else if (role == Types.Teacher)
            {
                TeacherStatistics statistics = bl.GetTeacherStatistics(username);
                circleList.Add(new CircleDataViewModel()
                {
                    ID       = "quadrant1",
                    Title    = "אחוז החניכים שלימדתי מתוך הסך",
                    Value    = this.GetPercent(statistics.NumOfTeachedStudents),
                    MaxValue = 100
                });

                circleList.Add(new CircleDataViewModel()
                {
                    ID       = "quadrant2",
                    Title    = "אחוז השעות הלימוד מתוך סך הפגישות",
                    Value    = this.GetPercent(statistics.NumOfHours),
                    MaxValue = 100
                });

                circleList.Add(new CircleDataViewModel()
                {
                    ID       = "quadrant3",
                    Title    = "אחוז הפגישות שאושרו על-ידי חניכים",
                    Value    = this.GetPercent(statistics.NumOfApprovalSessions),
                    MaxValue = 100
                });

                circleList.Add(new CircleDataViewModel()
                {
                    ID       = "quadrant4",
                    Title    = "אחוז הפגישות שהן שיעור יחיד מתוך הסך ",
                    Value    = this.GetPercent(statistics.NumOfSingleRefunds),
                    MaxValue = 100
                });
            }
            else if (role == Types.Admin)
            {
                ManagerStatistics statistics = bl.GetManagerStatistics(username);
                circleList.Add(new CircleDataViewModel()
                {
                    ID       = "quadrant1",
                    Title    = "אחוז הבקשות שאישרתי מתוך סך הבקשות",
                    Value    = this.GetPercent(statistics.NumOfApprovalRequets),
                    MaxValue = 100
                });

                circleList.Add(new CircleDataViewModel()
                {
                    ID       = "quadrant2",
                    Title    = "אחוז ההודעות ששלחתי מתוך ההודעות שקיבלתי",
                    Value    = this.GetPercent(statistics.NumOfMessages),
                    MaxValue = 100
                });

                circleList.Add(new CircleDataViewModel()
                {
                    ID       = "quadrant3",
                    Title    = "אחוז החניכים מתוך כלל המשתמשים",
                    Value    = this.GetPercent(statistics.NumOfStudents),
                    MaxValue = 100
                });

                circleList.Add(new CircleDataViewModel()
                {
                    ID       = "quadrant4",
                    Title    = "אחוז הבקשות שהן לשיעורי אנגלית מתוך כלל הבקשות",
                    Value    = this.GetPercent(statistics.NumOfENRequets),
                    MaxValue = 100
                });
            }
            else
            {
                return(new List <CircleDataViewModel>());
            }
            return(circleList);
        }