This commit is contained in:
parent
d14f30b583
commit
e27cafe094
@ -6,13 +6,14 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Data.RemoteData.DAO
|
||||
{
|
||||
|
||||
public class UserDao
|
||||
{
|
||||
public string FIO { get; set; }
|
||||
public Guid Guid { get; set; }
|
||||
|
||||
public virtual GroupDao Group { get; set; }
|
||||
|
||||
public required string FIO { get; set; }
|
||||
public Guid UserGuid { get; set; }
|
||||
public GroupDao Group { get; set; }
|
||||
public required int GroupID { get; set; }
|
||||
public List<PresnceDao> Presences { get; set; } = new List<PresnceDao>();
|
||||
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ namespace data.RemoteData
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<GroupDao>().HasKey(group => group.Id);
|
||||
modelBuilder.Entity<UserDao>().HasKey(user => user.Guid);
|
||||
modelBuilder.Entity<UserDao>().HasKey(user => user.UserGuid);
|
||||
modelBuilder.Entity<PresnceDao>().HasKey(presence => new {
|
||||
presence.UserGuid,
|
||||
presence.IsAttendensy,
|
||||
|
Binary file not shown.
Binary file not shown.
@ -13,10 +13,10 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("data")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5124d95d3daae0a4fb8c67dff74fc5e25268f700")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d14f30b58346596546b30dc44d61ffae0ddb1b9a")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("data")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("data")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
// Создано классом WriteCodeFragment MSBuild.
|
||||
|
||||
|
@ -1 +1 @@
|
||||
f79085eebfdd7035c27d101a32916355d93e5f513df432f9a3075f4253aa1b2c
|
||||
da6e5904672a15e9743c288bc5b94fbac57fa66388ba1cb5e535fe3bfb0750aa
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,10 +13,10 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("domain")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5124d95d3daae0a4fb8c67dff74fc5e25268f700")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d14f30b58346596546b30dc44d61ffae0ddb1b9a")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("domain")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("domain")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
// Создано классом WriteCodeFragment MSBuild.
|
||||
|
||||
|
@ -1 +1 @@
|
||||
9c029f0b724d07a712a5d941d1aa11410bfa94baebf4624d9063852c950ebe3f
|
||||
15dde5298e0a2aca57d1a2b1eb4e9e31f4cb84ae24a21e988fca6c201a5add95
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
50
ui/Apiska.cs
50
ui/Apiska.cs
@ -0,0 +1,50 @@
|
||||
using Data.RemoteData.DAO;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Zurnal.RemaDateBase.DateDao
|
||||
{
|
||||
public class GroupInfo
|
||||
{
|
||||
public int TotalStudents { get; set; }
|
||||
public int TotalLessons { get; set; }
|
||||
public double AttendancePercentage { get; set; }
|
||||
public List<StudentAttendance> StudentAttendances { get; set; }
|
||||
}
|
||||
|
||||
public class StudentAttendance
|
||||
{
|
||||
public string FIO { get; set; }
|
||||
public int AttendedLessons { get; set; }
|
||||
public int MissedLessons { get; set; }
|
||||
public double AttendanceRate { get; set; }
|
||||
}
|
||||
|
||||
public class GroupService
|
||||
{
|
||||
public GroupInfo GetGroupInfo(GroupDao group)
|
||||
{
|
||||
var students = group.Users.ToList();
|
||||
var totalLessons = students.SelectMany(u => u.Group.Users.SelectMany(p => p.Presences)).Count();
|
||||
var totalAttendance = students.Sum(u => u.Presences.Count(p => p.IsAttendensy));
|
||||
var attendancePercentage = totalLessons > 0 ? (double)totalAttendance / totalLessons * 100 : 0;
|
||||
|
||||
var studentAttendances = students.Select(u => new StudentAttendance
|
||||
{
|
||||
FIO = u.FIO,
|
||||
AttendedLessons = u.Presences.Count(p => p.IsAttendensy),
|
||||
MissedLessons = u.Presences.Count(p => !p.IsAttendensy),
|
||||
AttendanceRate = totalLessons > 0 ? (double)u.Presences.Count(p => p.IsAttendensy) / totalLessons * 100 : 0
|
||||
}).ToList();
|
||||
|
||||
return new GroupInfo
|
||||
{
|
||||
TotalStudents = students.Count,
|
||||
TotalLessons = totalLessons,
|
||||
AttendancePercentage = attendancePercentage,
|
||||
StudentAttendances = studentAttendances
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("ui")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5124d95d3daae0a4fb8c67dff74fc5e25268f700")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d14f30b58346596546b30dc44d61ffae0ddb1b9a")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("ui")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("ui")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
@ -1 +1 @@
|
||||
949b5e9c101aeb5918553be7acfbb6a7908a62a118405d2f2df4707237ffb8cf
|
||||
4e7c2fe91495819803332ae21fc74a7aec753055f4a797d99eb398f35ee67a01
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user