private void student_stst_btn_Click(object sender, EventArgs e) { StudentStat studentStat = new StudentStat(); studentStat.Show(); this.Close(); }
public TopicMasteryStat[] GetTopicMasteryStats() { Mutex.WaitOne(); TopicMasteryStat[] stats = new TopicMasteryStat[6]; var students = GetDbSet <Account>().Where(account => account.Permission == 0); for (int i = 0; i < 6; i++) { stats[i] = new TopicMasteryStat(); stats[i].TopicId = (i + 1); foreach (var student in students) { StudentStat stat = new StudentStat(student.FullName, student.Class, student.Year, student.Semester); stats[i].StudentStatsKeyValuePair[student.Id] = stat; } } var attempt = GetDbSet <QuestionAttempted>() .Include(attempt => attempt.Account) .Include(attempt => attempt.Question) .ThenInclude(question => question.Answers) .Include(attempt => attempt.Answer).Where(attempt => attempt.Question.IsCustom != 1).GroupBy(attempt => attempt.Question.TopicId); Mutex.ReleaseMutex(); foreach (var topicAttempt in attempt) // get the attempt of each topic { int topicId = topicAttempt.Key; // Create a list of student in the system identified by their Id // MEDIAN // obtain correctness % of each student var studentsCorrectness = topicAttempt.GroupBy(item => item.Account.Id); foreach (var student in studentsCorrectness) { if (stats[topicId - 1].StudentStatsKeyValuePair.ContainsKey(student.Key)) { stats[topicId - 1].StudentStatsKeyValuePair[student.Key].Attempts.AddRange(student.ToList()); } } } return(stats); }