From 3eca2dd8f1df208f96109526c9875abc4489d29a Mon Sep 17 00:00:00 2001 From: Userok Date: Mon, 28 Oct 2024 15:03:35 +0300 Subject: [PATCH] --- Zurnal/UI/Info.cs | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/Zurnal/UI/Info.cs b/Zurnal/UI/Info.cs index 73479d0..abbd59b 100644 --- a/Zurnal/UI/Info.cs +++ b/Zurnal/UI/Info.cs @@ -1,4 +1,7 @@ -using System.Text.RegularExpressions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; using Zurnal.RemaDateBase.DateDao; public class GroupAttendanceService @@ -7,13 +10,13 @@ public class GroupAttendanceService public void DisplayGroupInfo() { - Console.WriteLine( $"Группа: {GroupName}"); - Console.WriteLine( $"Количество студентов: {Count()}"); - - var totalClasses = new AttendanceCounter(attendances).CountAttendances(UserGuid); + Console.WriteLine($"Группа: {GroupName}"); + Console.WriteLine($"Количество студентов: {Count()}"); + + var totalClasses = new AttendanceCounter(attendances).CountAttendances(userGuid); Console.WriteLine($"Количество проведенных занятий: {totalClasses}"); - - var overallAttendancePercentage = CalculateAttendancePercentage(); + + var overallAttendancePercentage = CalculateAttendancePercentage(attendances, userGuid); Console.WriteLine($"Общий процент посещаемости: {overallAttendancePercentage:F2}%"); Console.WriteLine("Список студентов:"); @@ -24,19 +27,19 @@ public class GroupAttendanceService } } -public class AttendanceCounter -{ - private List _attendances; - - public AttendanceCounter(List attendances) + public class AttendanceCounter { - _attendances = attendances; - } + private List _attendances; - public int CountAttendances(Guid userGuid) - { - return _attendances.Count(a => a.UserGuid == userGuid && a.IsAttendensy); - } + public AttendanceCounter(List attendances) + { + _attendances = attendances; + } + + public int CountAttendances(Guid userGuid) + { + return _attendances.Count(a => a.UserGuid == userGuid && a.IsAttendensy); + } internal object CountAttendances(object userGuid) {