< Summary

Information
Class: Syki.Back.Features.Adm.GetAdmInsights.GetAdmInsightsService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Adm/GetAdmInsights/GetAdmInsightsService.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 29
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/Adm/GetAdmInsights/GetAdmInsightsService.cs

#LineLine coverage
 1using Dapper;
 2using Npgsql;
 3
 4namespace Syki.Back.Features.Adm.GetAdmInsights;
 5
 16public class GetAdmInsightsService(DatabaseSettings settings) : IAdmService
 7{
 8    public async Task<AdmInsightsOut> Get()
 9    {
 110        using var connection = new NpgsqlConnection(settings.ConnectionString);
 11
 12        const string sql = @"
 13            SELECT
 14                COUNT(1)-1                                     AS institutions,
 15                (SELECT COUNT(1)-1 FROM syki.users)            AS users,
 16                (SELECT COUNT(1) FROM syki.campi)              AS campi,
 17                (SELECT COUNT(1) FROM syki.courses)            AS courses,
 18                (SELECT COUNT(1) FROM syki.disciplines)        AS disciplines,
 19                (SELECT COUNT(1) FROM syki.course_curriculums) AS course_curriculums,
 20                (SELECT COUNT(1) FROM syki.course_offerings)   AS course_offerings,
 21                (SELECT COUNT(1) FROM syki.teachers)           AS teachers,
 22                (SELECT COUNT(1) FROM syki.students)           AS students
 23            FROM
 24              syki.institutions
 25        ";
 26
 127        return await connection.QueryFirstAsync<AdmInsightsOut>(sql);
 128    }
 29}