< Summary

Information
Class: Syki.Back.Features.Academic.CreateDiscipline.CreateDisciplineService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Academic/CreateDiscipline/CreateDisciplineService.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 21
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

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

File(s)

/home/runner/work/syki/syki/Back/Features/Academic/CreateDiscipline/CreateDisciplineService.cs

#LineLine coverage
 1namespace Syki.Back.Features.Academic.CreateDiscipline;
 2
 17963public class CreateDisciplineService(SykiDbContext ctx) : IAcademicService
 4{
 5    public async Task<DisciplineOut> Create(Guid institutionId, CreateDisciplineIn data)
 6    {
 17967        var discipline = new Discipline(institutionId, data.Name);
 8
 17969        var courses = await ctx.Courses
 179610            .Where(c => c.InstitutionId == institutionId && data.Courses.Contains(c.Id))
 179611            .Select(c => c.Id)
 179612            .ToListAsync();
 13
 357214        courses.ForEach(id => discipline.Links.Add(new() { CourseId = id }));
 15
 179616        ctx.Add(discipline);
 179617        await ctx.SaveChangesAsync();
 18
 179619        return discipline.ToOut();
 179620    }
 21}