< Summary - Syki

Information
Class: Syki.Back.Features.Cross.GetHomeStats.GetHomeStatsService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Cross/GetHomeStats/GetHomeStatsService.cs
Tag: 97_27801654829
Line coverage
0%
Covered lines: 0
Uncovered lines: 22
Coverable lines: 22
Total lines: 33
Line coverage: 0%
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%210%
Get()100%210%

File(s)

/home/runner/work/syki/syki/Back/Features/Cross/GetHomeStats/GetHomeStatsService.cs

#LineLine coverage
 1namespace Syki.Back.Features.Cross.GetHomeStats;
 2
 03public class GetHomeStatsService(SykiDbContext ctx) : ISykiService
 4{
 5    public async Task<GetHomeStatsOut> Get()
 6    {
 07        var institutionId = ctx.RequestUser.InstitutionId;
 8
 09        var enrolledStudents = await ctx.StudentCourseEnrollments.AsNoTracking()
 010            .Where(e => e.LeftAt == null && ctx.Students.Any(s => s.Id == e.StudentId && s.InstitutionId == institutionI
 011            .CountAsync();
 12
 013        var activeTeachers = await ctx.Teachers.AsNoTracking()
 014            .Where(t => t.InstitutionId == institutionId)
 015            .CountAsync();
 16
 017        var offeredCourses = await ctx.CourseOfferings.AsNoTracking()
 018            .Where(o => o.InstitutionId == institutionId)
 019            .CountAsync();
 20
 021        var registeredDisciplines = await ctx.Disciplines.AsNoTracking()
 022            .Where(d => d.InstitutionId == institutionId)
 023            .CountAsync();
 24
 025        return new GetHomeStatsOut
 026        {
 027            EnrolledStudents = enrolledStudents,
 028            ActiveTeachers = activeTeachers,
 029            OfferedCourses = offeredCourses,
 030            RegisteredDisciplines = registeredDisciplines,
 031        };
 032    }
 33}