< Summary - Syki

Information
Class: Syki.Back.Features.Student.GetStudentInsights.GetStudentInsightsService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Student/GetStudentInsights/GetStudentInsightsService.cs
Tag: 4_16869239191
Line coverage
100%
Covered lines: 19
Uncovered lines: 0
Coverable lines: 19
Total lines: 32
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%
Get()100%11100%

File(s)

/home/runner/work/syki/syki/Back/Features/Student/GetStudentInsights/GetStudentInsightsService.cs

#LineLine coverage
 1using Syki.Back.Features.Student.GetStudentFrequency;
 2using Syki.Back.Features.Student.GetStudentAverageNote;
 3
 4namespace Syki.Back.Features.Student.GetStudentInsights;
 5
 46public class GetStudentInsightsService(SykiDbContext ctx, GetStudentFrequencyService frequencyService, GetStudentAverage
 7{
 8    public async Task<StudentInsightsOut> Get(Guid userId, Guid courseCurriculumId)
 9    {
 410        var student = await ctx.Students.FirstAsync(x => x.Id == userId);
 11
 412        var totalDisciplines = await ctx.CourseCurriculumDisciplines.AsNoTracking()
 413            .Where(g => g.CourseCurriculumId == courseCurriculumId)
 414            .CountAsync();
 415        var finishedDisciplines = await ctx.ClassesStudents
 416            .Where(x => x.SykiStudentId == userId && x.StudentDisciplineStatus == StudentDisciplineStatus.Aprovado)
 417            .CountAsync();
 18
 419        var frequency = await frequencyService.Get(userId);
 20
 421        var averageNote = await averageNoteService.Get(userId);
 22
 423        return new()
 424        {
 425            Status = student.Status,
 426            TotalDisciplines = totalDisciplines,
 427            FinishedDisciplines = finishedDisciplines,
 428            Frequency = frequency.Frequency,
 429            Average = averageNote,
 430        };
 431    }
 32}