< Summary

Information
Class: Syki.Back.Features.Student.GetStudentInsights.GetStudentInsightsService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Student/GetStudentInsights/GetStudentInsightsService.cs
Tag: 22_11348620282
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
 26public class GetStudentInsightsService(SykiDbContext ctx, GetStudentFrequencyService frequencyService, GetStudentAverage
 7{
 8    public async Task<StudentInsightsOut> Get(Guid userId, Guid courseCurriculumId)
 9    {
 210        var student = await ctx.Students.FirstAsync(x => x.Id == userId);
 11
 212        var totalDisciplines = await ctx.CourseCurriculumDisciplines.AsNoTracking()
 213            .Where(g => g.CourseCurriculumId == courseCurriculumId)
 214            .CountAsync();
 215        var finishedDisciplines = await ctx.ClassesStudents
 216            .Where(x => x.SykiStudentId == userId && x.StudentDisciplineStatus == StudentDisciplineStatus.Aprovado)
 217            .CountAsync();
 18
 219        var frequency = await frequencyService.Get(userId);
 20
 221        var averageNote = await averageNoteService.Get(userId);
 22
 223        return new()
 224        {
 225            Status = student.Status,
 226            TotalDisciplines = totalDisciplines,
 227            FinishedDisciplines = finishedDisciplines,
 228            Frequency = frequency.Frequency,
 229            Average = averageNote,
 230        };
 231    }
 32}