< Summary

Information
Class: Syki.Back.Features.Academic.GetDisciplines.GetDisciplinesService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Academic/GetDisciplines/GetDisciplinesService.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 21
Line coverage: 100%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
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()50%44100%

File(s)

/home/runner/work/syki/syki/Back/Features/Academic/GetDisciplines/GetDisciplinesService.cs

#LineLine coverage
 1namespace Syki.Back.Features.Academic.GetDisciplines;
 2
 13public class GetDisciplinesService(SykiDbContext ctx) : IAcademicService
 4{
 5    public async Task<List<DisciplineOut>> Get(Guid institutionId, Guid? courseId)
 6    {
 17        var ids = await ctx.CoursesDisciplines
 18            .Where(cd => cd.CourseId == courseId)
 19            .Select(cd => cd.DisciplineId)
 110            .ToListAsync();
 11
 112        if (courseId != null && ids.Count == 0) return [];
 13
 114        var disciplines = await ctx.Disciplines
 115            .Where(d => d.InstitutionId == institutionId && (ids.Count == 0 || ids.Contains(d.Id)))
 116            .OrderBy(d => d.Name)
 117            .ToListAsync();
 18
 719        return disciplines.ConvertAll(d => d.ToOut());
 120    }
 21}