< Summary

Information
Class: Syki.Front.Features.Student.GetStudentInsights.StudentInsightsPage
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Features/Student/GetStudentInsights/StudentInsightsPage.razor
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 13
Coverable lines: 13
Total lines: 69
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%
SetUserName()0%620%

File(s)

/home/runner/work/syki/syki/Front/Features/Student/GetStudentInsights/StudentInsightsPage.razor

#LineLine coverage
 1@namespace Syki.Front.Features.Student.GetStudentInsights
 2
 3<MudContainer Class="my-4 px-4">
 4    <MudText Typo="Typo.h4" Style="font-weight: bold" Class="ml-2">
 5        Olá, @_userName
 6    </MudText>
 7    <MudAlert Class="mt-4" NoIcon="true" Severity="Severity.Normal" Variant="Variant.Text" Elevation="1">
 8        <MudStack Row="true" Justify="Justify.SpaceAround">
 9            <MudText>Aqui você encontra dados consolidados sobre seu curso.</MudText>
 10        </MudStack>
 11    </MudAlert>
 12    <MudGrid Class="pt-4" Spacing="4">
 13        <StudentInsightCard
 14            Icon="@Icons.Material.Filled.Person4"
 15            Title="Status"
 16            Text="@($"{_data.Status.GetDescription()}")"
 17            Loading="@_loading"
 18        />
 19        <StudentInsightCard
 20            Icon="@Icons.Material.Filled.CheckCircle"
 21            Title="Disciplinas"
 22            Text="@($"{_data.FinishedDisciplines} / {_data.TotalDisciplines}")"
 23            Loading="@_loading"
 24        />
 25        <StudentInsightCard
 26            Icon="@Icons.Material.Filled.CoPresent"
 27            Title="Frequência"
 28            Text="@($"{_data.Frequency.Format()}%")"
 29            Loading="@_loading"
 30        />
 31        <StudentInsightCard
 32            Icon="@Icons.Material.Filled.GroupWork"
 33            Title="Média"
 34            Text="@($"{_data.Average.Format()}")"
 35            Loading="@_loading"
 36        />
 37    </MudGrid>
 38</MudContainer>
 39
 40@inject GetStudentInsightsClient Client
 41
 42@code
 43{
 44    [CascadingParameter]
 045    public Task<AuthenticationState> AuthState { get; set; }
 46
 47    private bool _loading;
 048    private string _userName = "";
 049    private StudentInsightsOut _data = new();
 50
 51    protected override async Task OnInitializedAsync()
 52    {
 053        _loading = true;
 054        await SetUserName();
 055        _data = await Client.Get();
 056        _loading = false;
 057    }
 58
 59    private async Task SetUserName()
 60    {
 061        var state = await AuthState;
 62
 063        var claim = state.User.FindFirst("name");
 064        if (claim != null)
 65        {
 066            _userName = claim.Value;
 67        }
 068    }
 69}