< Summary

Information
Class: Syki.Back.Features.Academic.GetAcademicInsights.GetAcademicInsightsService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Academic/GetAcademicInsights/GetAcademicInsightsService.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 33
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/Academic/GetAcademicInsights/GetAcademicInsightsService.cs

#LineLine coverage
 1using Dapper;
 2using Npgsql;
 3
 4namespace Syki.Back.Features.Academic.GetAcademicInsights;
 5
 16public class GetAcademicInsightsService(DatabaseSettings settings) : IAcademicService
 7{
 8    public async Task<AcademicInsightsOut> Get(Guid institutionId)
 9    {
 110        using var connection = new NpgsqlConnection(settings.ConnectionString);
 11
 12        const string sql = @"
 13            SELECT
 14                (SELECT COUNT(1) FROM syki.campi WHERE institution_id = i.id)              AS campus,
 15                (SELECT COUNT(1) FROM syki.courses WHERE institution_id = i.id)            AS courses,
 16                (SELECT COUNT(1) FROM syki.disciplines WHERE institution_id = i.id)        AS disciplines,
 17                (SELECT COUNT(1) FROM syki.course_curriculums WHERE institution_id = i.id) AS course_curriculums,
 18                (SELECT COUNT(1) FROM syki.course_offerings WHERE institution_id = i.id)   AS course_offerings,
 19                (SELECT COUNT(1) FROM syki.classes WHERE institution_id = i.id)            AS classes,
 20                (SELECT COUNT(1) FROM syki.teachers WHERE institution_id = i.id)           AS teachers,
 21                (SELECT COUNT(1) FROM syki.students WHERE institution_id = i.id)           AS students,
 22                (SELECT COUNT(1) FROM syki.notifications WHERE institution_id = i.id)      AS notifications
 23            FROM
 24              syki.institutions i
 25            WHERE
 26              i.id = @Id
 27        ";
 28
 129        var parameters = new { Id = institutionId };
 30
 131        return await connection.QueryFirstAsync<AcademicInsightsOut>(sql, parameters);
 132    }
 33}