< Summary

Information
Class: Syki.Back.Features.Academic.UpdateEnrollmentPeriod.UpdateEnrollmentPeriodService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Academic/UpdateEnrollmentPeriod/UpdateEnrollmentPeriodService.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 21
Line coverage: 100%
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
.ctor(...)100%11100%
Update()100%66100%

File(s)

/home/runner/work/syki/syki/Back/Features/Academic/UpdateEnrollmentPeriod/UpdateEnrollmentPeriodService.cs

#LineLine coverage
 1namespace Syki.Back.Features.Academic.UpdateEnrollmentPeriod;
 2
 3073public class UpdateEnrollmentPeriodService(SykiDbContext ctx) : IAcademicService
 4{
 5    public async Task<OneOf<EnrollmentPeriodOut, SykiError>> Update(Guid institutionId, string id, UpdateEnrollmentPerio
 6    {
 417        var academicPeriodExists = await ctx.AcademicPeriodExists(institutionId, id);
 428        if (!academicPeriodExists) return new AcademicPeriodNotFound();
 9
 4010        var period = await ctx.EnrollmentPeriods.FirstOrDefaultAsync(x => x.InstitutionId == institutionId && x.Id == id
 4111        if (period == null) return new EnrollmentPeriodNotFound();
 12
 3913        var result = period.Update(data.StartAt, data.EndAt);
 14
 4115        if (result.IsError()) return result.GetError();
 16
 3717        await ctx.SaveChangesAsync();
 18
 3719        return period.ToOut();
 4120    }
 21}