< Summary - Estud

Information
Class: Estud.Back.Domain.Classes.Class
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Domain/Classes/Class.cs
Tag: 114_29044117136
Line coverage
97%
Covered lines: 46
Uncovered lines: 1
Coverable lines: 47
Total lines: 78
Line coverage: 97.8%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Id()100%11100%
get_InstitutionId()100%11100%
get_DisciplineId()100%11100%
get_Discipline()100%11100%
get_PeriodId()100%210%
get_Period()100%11100%
get_Vacancies()100%11100%
get_Status()100%11100%
get_Workload()100%11100%
get_CampusId()100%11100%
get_TeacherId()100%11100%
get_Teacher()100%11100%
get_Schedules()100%11100%
get_Lessons()100%11100%
get_Students()100%11100%
.ctor()100%11100%
.ctor(...)100%11100%
CreateLessons()100%66100%

File(s)

/home/runner/work/syki/syki/Back/Domain/Classes/Class.cs

#LineLine coverage
 1using Estud.Back.Domain.Periods;
 2using Estud.Back.Domain.Teachers;
 3using Estud.Back.Domain.Students;
 4using Estud.Back.Domain.Disciplines;
 5
 6namespace Estud.Back.Domain.Classes;
 7
 8/// <summary>
 9/// Turma
 10/// </summary>
 11public class Class
 12{
 1213    public int Id { get; set; }
 814    public int InstitutionId { get; set; }
 15
 816    public int DisciplineId { get; set; }
 417    public Discipline Discipline { get; set; }
 18
 019    public int PeriodId { get; set; }
 123620    public AcademicPeriod Period { get; set; }
 21
 1222    public int Vacancies { get; set; }
 2223    public ClassStatus Status { get; set; }
 33624    public int Workload { get; set; }
 25
 826    public int? CampusId { get; set; }
 27
 828    public int? TeacherId { get; set; }
 429    public EstudTeacher Teacher { get; set; }
 30
 2031    public List<Schedule> Schedules { get; set; }
 17632    public List<ClassLesson> Lessons { get; set; }
 833    public List<EstudStudent> Students { get; set; }
 34
 1235    private Class() {}
 36
 837    public Class(
 838        int institutionId,
 839        int disciplineId,
 840        int? campusId,
 841        int? teacherId,
 842        AcademicPeriod period,
 843        int vacancies,
 844        List<Schedule> schedules
 845    ) {
 846        InstitutionId = institutionId;
 847        DisciplineId = disciplineId;
 848        CampusId = campusId;
 849        TeacherId = teacherId;
 850        Period = period;
 851        Vacancies = vacancies;
 852        Status = ClassStatus.OnPreEnrollment;
 853        Schedules = schedules;
 854        Lessons = [];
 855        Students = [];
 856    }
 57
 58    public void CreateLessons()
 59    {
 860        var schedules = Schedules.OrderBy(x => x.Day).ThenBy(x => x.Start).ToList();
 61
 862        var number = 1;
 863        var current = Period.StartAt;
 121664        while (current < Period.EndAt)
 65        {
 483266            foreach (var schedule in schedules)
 67            {
 120868                if (current.DayOfWeek.Is(schedule.Day))
 69                {
 16870                    Lessons.Add(new(this, number, current, schedule.Start, schedule.End));
 16871                    Workload += schedule.GetDiff();
 16872                    number++;
 73                }
 74            }
 120875            current = current.AddDays(1);
 76        }
 877    }
 78}