< Summary

Information
Class: Syki.Front.Features.Teacher.GetTeacherInsights.TeacherInsightsPage
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Features/Teacher/GetTeacherInsights/TeacherInsightsPage.razor
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 14
Coverable lines: 14
Total lines: 55
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_AuthState()100%210%
.ctor()100%210%
OnInitializedAsync()100%210%
GetLessonsMessage()100%210%
SetUserName()0%620%

File(s)

/home/runner/work/syki/syki/Front/Features/Teacher/GetTeacherInsights/TeacherInsightsPage.razor

#LineLine coverage
 1@using Syki.Front.Components.Indexes
 2
 3@namespace Syki.Front.Features.Teacher.GetTeacherInsights
 4
 5<MudContainer Class="my-4 px-4">
 6    <MudText Typo="Typo.h4" Style="font-weight: bold" Class="ml-2">
 7        Olá, @_userName
 8    </MudText>
 9    <MudAlert Class="mt-4" NoIcon="true" Severity="Severity.Normal" Variant="Variant.Text" Elevation="1">
 10        <MudStack Row="true" Justify="Justify.SpaceAround">
 11            <MudText>Aqui você encontra dados consolidados sobre suas turmas.</MudText>
 12        </MudStack>
 13    </MudAlert>
 14    <MudGrid Class="pt-4" Spacing="4">
 15        <IndexCard Loading="@_loading" Icon="@Icons.Material.Filled.CheckCircle" Value="@_data.Classes" Text="Turmas" />
 16        <IndexCard Loading="@_loading" Icon="@Icons.Material.Filled.School" Value="@_data.Students" Text="Alunos" />
 17        <TeacherInsightCard Loading="@_loading" Icon="@Icons.Material.Filled.Class" Text="@GetLessonsMessage()" />
 18    </MudGrid>
 19</MudContainer>
 20
 21@inject GetTeacherInsightsClient Client
 22
 23@code
 24{
 25    [CascadingParameter]
 026    public Task<AuthenticationState> AuthState { get; set; }
 27
 28    private bool _loading;
 029    private string _userName = "";
 030    private TeacherInsightsOut _data = new();
 31
 32    protected override async Task OnInitializedAsync()
 33    {
 034        _loading = true;
 035        await SetUserName();
 036        _data = await Client.Get();
 037        _loading = false;
 038    }
 39
 40    private string GetLessonsMessage()
 41    {
 042        return $"{_data.FinalizedLessons}/{_data.TotalLessons} Aulas";
 43    }
 44
 45    private async Task SetUserName()
 46    {
 047        var state = await AuthState;
 48
 049        var claim = state.User.FindFirst("name");
 050        if (claim != null)
 51        {
 052            _userName = claim.Value;
 53        }
 054    }
 55}