< Summary

Information
Class: Syki.Back.Features.Student.GetCurrentEnrollmentPeriod.GetCurrentEnrollmentPeriodService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Student/GetCurrentEnrollmentPeriod/GetCurrentEnrollmentPeriodService.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 17
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
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%
Get()100%22100%

File(s)

/home/runner/work/syki/syki/Back/Features/Student/GetCurrentEnrollmentPeriod/GetCurrentEnrollmentPeriodService.cs

#LineLine coverage
 1namespace Syki.Back.Features.Student.GetCurrentEnrollmentPeriod;
 2
 43public class GetCurrentEnrollmentPeriodService(SykiDbContext ctx) : IStudentService
 4{
 5    public async Task<EnrollmentPeriodOut> Get(Guid institutionId)
 6    {
 47        var today = DateTime.Now.ToDateOnly();
 48        var period = await ctx.EnrollmentPeriods.AsNoTracking()
 49            .Where(p => p.InstitutionId == institutionId && p.StartAt <= today && p.EndAt >= today)
 410            .FirstOrDefaultAsync();
 11
 412        if (period == null)
 313            return new();
 14
 115        return period.ToOut();
 416    }
 17}