|
@@ -2,6 +2,7 @@
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
|
using System.Linq;
|
|
|
+using EducationDepartament.Views;
|
|
|
using EducationDepartment.Models;
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
@@ -59,30 +60,64 @@ namespace EducationDepartment.ViewModels
|
|
|
{
|
|
|
if (OptionValue == "Вся группа")
|
|
|
{
|
|
|
- ParameterName = "Студент";
|
|
|
+ ParameterName = $"Студенты группы {secondSelectedOption}";
|
|
|
//извлечь студента группы + расчет посещаемости по всем дисц
|
|
|
+ foreach(var student in connect.Students.Include(x=>x.User).Include(x=>x.Group)
|
|
|
+ .Where(x=>x.Group.Name == secondSelectedOption).Select(x => x.User).ToList())
|
|
|
+ {
|
|
|
+ var data = connect.Attendances.Include(x => x.Student).Where(x => x.Student.User == student);
|
|
|
+ if(data.Count()==0) AttendanceTable.Add(new AttendanceInfo(student.ToString(),1));
|
|
|
+ else AttendanceTable.Add(new AttendanceInfo(student.ToString(),
|
|
|
+ (double)(data.Count(x=>x.Attended))/data.Count()));
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- ParameterName = "Дисциплина";
|
|
|
+ ParameterName = $"Дисциплины студента {optionValue}";
|
|
|
//извлечь дисцилину студента + расчет посещаемости
|
|
|
+ foreach (var studentDiscipline in connect.Groupdisciplines.Include(x => x.TeacherDiscipline.Discipline)
|
|
|
+ .Include(x => x.Group).Where(x => x.Group.Name == secondSelectedOption).Select(x => x.TeacherDiscipline.Discipline).ToList())
|
|
|
+ {
|
|
|
+ var data = connect.Attendances.Include(x => x.Student).Include(x => x.Timetable.GroupDiscipline.TeacherDiscipline.Discipline)
|
|
|
+ .Where(x => x.Student.User.ToString() == optionValue && x.Timetable.GroupDiscipline.TeacherDiscipline.Discipline == studentDiscipline).ToList();
|
|
|
+ if(data.Count==0) AttendanceTable.Add(new AttendanceInfo(studentDiscipline.Name, 1));
|
|
|
+ else AttendanceTable.Add(new AttendanceInfo(studentDiscipline.Name,
|
|
|
+ (double)(data.Count(x => x.Attended)) / data.Count()
|
|
|
+ ));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else if (selectedOption == "Дисциплина")
|
|
|
{
|
|
|
if (OptionValue == "Все группы")
|
|
|
- {
|
|
|
- ParameterName = "Группа";
|
|
|
+ {
|
|
|
+ ParameterName = $"Группы на дисциплине {secondSelectedOption}";
|
|
|
//извлечь группу посещающую дисциплину + расчет
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ParameterName = "Студент";
|
|
|
+ foreach (var group in connect.Groupdisciplines.Include(x => x.Group).Include(x => x.TeacherDiscipline.Discipline)
|
|
|
+ .Where(x => x.TeacherDiscipline.Discipline.Name == secondSelectedOption).Select(x => x.Group))
|
|
|
+ {
|
|
|
+ var data = connect.Attendances.Include(x => x.Timetable.GroupDiscipline.Group)
|
|
|
+ .Include(x => x.Timetable.GroupDiscipline.TeacherDiscipline.Discipline)
|
|
|
+ .Where(x => x.Timetable.GroupDiscipline.Group == group &&
|
|
|
+ x.Timetable.GroupDiscipline.TeacherDiscipline.Discipline.Name == secondSelectedOption);
|
|
|
+ if (data.Count() == 0) AttendanceTable.Add(new AttendanceInfo(group.Name, 1));
|
|
|
+ else
|
|
|
+ AttendanceTable.Add(new AttendanceInfo(group.Name,
|
|
|
+ (double)(data.Count(x => x.Attended)) / data.Count()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ParameterName = $"Студенты группы {optionValue}";
|
|
|
//извлечь студентов группы + их посещаемость предмета
|
|
|
+ foreach (var studentOnDiscipline in connect.Attendances.Include(x => x.Student).Include(x => x.Timetable.GroupDiscipline.TeacherDiscipline.Discipline)
|
|
|
+ .Include(x => x.Timetable.GroupDiscipline.Group)
|
|
|
+ .Where(x => x.Timetable.GroupDiscipline.Group.Name == secondSelectedOption && x.Timetable.GroupDiscipline.TeacherDiscipline.Discipline.Name == optionValue))
|
|
|
+ {
|
|
|
+ //??
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- //struct with: value - %
|
|
|
- //binding
|
|
|
}
|
|
|
List<AttendanceInfo> attendanceTable;
|
|
|
List<AttendanceInfo> AttendanceTable { get => attendanceTable; set { attendanceTable = value; OnPropertyChanged(nameof(AttendanceTable)); } }
|