< Summary

Information
Class: Syki.Front.Pages.Student.StudentExamGradesPage
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Pages/Student/StudentExamGradesPage.razor
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 12
Coverable lines: 12
Total lines: 115
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%210%
get__quickFilter()100%210%
OnInitializedAsync()100%210%
GetAverageNoteColor(...)0%620%

File(s)

/home/runner/work/syki/syki/Front/Pages/Student/StudentExamGradesPage.razor

#LineLine coverage
 1@namespace Syki.Front.Pages.Student
 2
 3@page "/student/exam-grades"
 4@attribute [Authorize(Roles = "Student")]
 5
 6<SykiPageTitle Title="Notas" />
 7
 8<MudContainer Class="my-4 px-4">
 9    <SykiPageHeader Icon="@Icons.Material.Filled.StickyNote2" Title="Notas" />
 10    <MudAlert Class="my-4 pl-6" NoIcon="true" Severity="Severity.Normal" Variant="Variant.Text" Elevation="1">
 11        <MudText>A nota mínima para ser aprovado é <b>7.00</b></MudText>
 12    </MudAlert>
 13    <MudContainer Class="px-0">
 14        <MudCard>
 15            <MudCardContent Class="px-6">
 016                @if (_loading)
 17                {
 18                    <MudProgressLinear Color="Color.Info" Indeterminate="true" />
 19                }
 20                else
 21                {
 22                    <MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
 23                        <MudProgressLinear Color="@GetAverageNoteColor(_student.AverageNote)" Max="10" Rounded="true" Si
 24                            <MudText Typo="Typo.body1">
 25                                <b>@_student.AverageNote.Format()</b>
 26                            </MudText>
 27                        </MudProgressLinear>
 28                        <MudTooltip Text="Nota média das disciplinas finalizadas" Arrow="true" Placement="Placement.Bott
 29                            <MudIconButton Icon="@Icons.Material.Filled.Info" Size="Size.Small" />
 30                        </MudTooltip>
 31                    </MudStack>
 32                }
 33            </MudCardContent>
 34        </MudCard>
 35    </MudContainer>
 36
 37    <MudContainer Class="px-0 my-4">
 38        <MudContainer Class="px-0 mb-4">
 39            <MudTable
 40                T="StudentExamGradeOut"
 41                Items="@_disciplines"
 42                Breakpoint="Breakpoint.Sm"
 43                Dense="true"
 44                Class="pa-4"
 45                Hover="true"
 46                Filter="@_quickFilter"
 47                Loading="@_loading"
 48                RowsPerPage="100"
 49            >
 50                <ToolBarContent>
 51                    <SykiDataGridSearchTextField @bind-Value="@_searchString" Placeholder="Busque por nome ou status"/>
 52                </ToolBarContent>
 53                <HeaderContent>
 54                    <MudTh>Disciplina</MudTh>
 55                    <MudTh>Período</MudTh>
 56                    <MudTh>Status</MudTh>
 57                    <MudTh>N1</MudTh>
 58                    <MudTh>N2</MudTh>
 59                    <MudTh>N3</MudTh>
 60                    <MudTh>Média</MudTh>
 61                </HeaderContent>
 62                <RowTemplate>
 63                    <MudTd DataLabel="Disciplina">@context.Discipline</MudTd>
 64                    <MudTd DataLabel="Período">@context.Period</MudTd>
 65                    <MudTd DataLabel="Status">@context.StudentDisciplineStatus.GetDescription()</MudTd>
 66                    <MudTd DataLabel="N1">@context.GetNote(ExamType.N1)</MudTd>
 67                    <MudTd DataLabel="N2">@context.GetNote(ExamType.N2)</MudTd>
 68                    <MudTd DataLabel="N3">@context.GetNote(ExamType.N3)</MudTd>
 69                    <MudTd DataLabel="Média">
 70                        <MudProgressLinear Color="@GetAverageNoteColor(context.AverageNote)" Max="10" Rounded="true" Siz
 71                            <MudText Typo="Typo.body1">
 72                                <b>@context.AverageNote.Format()</b>
 73                            </MudText>
 74                        </MudProgressLinear>
 75                    </MudTd>
 76                </RowTemplate>
 77                <LoadingContent>
 078                    @if (_breakpoint == Breakpoint.Xs)
 79                    {
 80                        <MudProgressLinear Color="Color.Info" Indeterminate="true"/>
 81                    }
 82                </LoadingContent>
 83            </MudTable>
 84        </MudContainer>
 85    </MudContainer>
 86</MudContainer>
 87
 88@inject IBrowserViewportService BrowserViewportService
 89@inject GetStudentAverageNoteClient AverageNotesClient
 90@inject GetStudentExamGradesClient StudentExamGradesClient
 91
 92@code
 93{
 94    private bool _loading;
 95    private string _searchString;
 96    private Breakpoint _breakpoint;
 097    private GetStudentAverageNoteOut _student = new();
 098    private List<StudentExamGradeOut> _disciplines = [];
 99
 0100    private Func<StudentExamGradeOut, bool> _quickFilter => x => _searchString.IsIn(x.Discipline, x.StudentDisciplineSta
 101
 102    protected override async Task OnInitializedAsync()
 103    {
 0104        _loading = true;
 0105        _breakpoint = await BrowserViewportService.GetCurrentBreakpointAsync();
 0106        _disciplines = await StudentExamGradesClient.Get();
 0107        _student = await AverageNotesClient.Get();
 0108        _loading = false;
 0109    }
 110
 111    private Color GetAverageNoteColor(decimal averageNote)
 112    {
 0113        return averageNote >= 7 ? Color.Tertiary : Color.Error;
 114    }
 115}