< Summary

Information
Class: Syki.Back.Features.Student.GetStudentDisciplines.GetStudentDisciplinesService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Student/GetStudentDisciplines/GetStudentDisciplinesService.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 20
Uncovered lines: 0
Coverable lines: 20
Total lines: 31
Line coverage: 100%
Branch coverage
33%
Covered branches: 2
Total branches: 6
Branch coverage: 33.3%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Get()100%11100%

File(s)

/home/runner/work/syki/syki/Back/Features/Student/GetStudentDisciplines/GetStudentDisciplinesService.cs

#LineLine coverage
 1namespace Syki.Back.Features.Student.GetStudentDisciplines;
 2
 13public class GetStudentDisciplinesService(SykiDbContext ctx) : IStudentService
 4{
 5    public async Task<List<DisciplineOut>> Get(Guid userId, Guid courseCurriculumId)
 6    {
 17        var courseCurriculum = await ctx.CourseCurriculums.AsNoTracking()
 18            .Include(g => g.Course)
 19            .Include(g => g.Disciplines)
 110            .Include(g => g.Links)
 111            .FirstAsync(g => g.Id == courseCurriculumId);
 12
 413        var response = courseCurriculum.ToOut().Disciplines.OrderBy(d => d.Period).ToList();
 14
 115        var studentClassesStatus = await ctx.ClassesStudents.AsNoTracking()
 116            .Where(x => x.SykiStudentId == userId)
 117            .ToListAsync();
 18
 419        var ids = courseCurriculum.Disciplines.ConvertAll(d => d.Id);
 120        var classes = await ctx.Classes.Where(t => ids.Contains(t.DisciplineId))
 121            .Select(x => new { x.Id, x.DisciplineId }).ToListAsync();
 22
 123        response.ForEach(r =>
 124        {
 325            var classId = classes.FirstOrDefault(x => x.DisciplineId == r.Id)?.Id;
 326            r.StudentDisciplineStatus = studentClassesStatus.FirstOrDefault(x => x.ClassId == classId)?.StudentDisciplin
 427        });
 28
 429        return response.OrderBy(x => x.Name).ToList();
 130    }
 31}