< Summary

Information
Class: Syki.Front.Pages.Teacher.TeacherClassNotesTab
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Pages/Teacher/TeacherClassNotesTab.razor
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 21
Coverable lines: 21
Total lines: 79
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_ClassId()100%210%
.ctor()100%210%
OnInitializedAsync()100%210%
Load()100%210%
AddNote()100%210%
get__quickFilter()100%210%
GetNotFoundMessage()0%620%

File(s)

/home/runner/work/syki/syki/Front/Pages/Teacher/TeacherClassNotesTab.razor

#LineLine coverage
 1@using Syki.Front.Features.Teacher.AddExamGradeNote
 2
 3@namespace Syki.Front.Pages.Teacher
 4
 5<MudContainer Class="mb-4 px-0">
 6    <MudDataGrid
 7        T="TeacherClassStudentOut"
 8        Class="pa-4"
 9        Items="@_students"
 10        QuickFilter="@_quickFilter"
 11        Hover="true"
 12        Dense="true"
 13        Loading="@_loading"
 14        RowsPerPage="100"
 15    >
 16        <ToolBarContent>
 17            <SykiDataGridSearchTextField @bind-Value="@_searchString" Placeholder="Busque por nome" />
 18        </ToolBarContent>
 19        <Columns>
 20            <PropertyColumn Property="x => x.Name" Title="Nome" />
 21            <PropertyColumn Property="x => x.GetNote(ExamType.N1)" Title="N1" />
 22            <PropertyColumn Property="x => x.GetNote(ExamType.N2)" Title="N2" />
 23            <PropertyColumn Property="x => x.GetNote(ExamType.N3)" Title="N3" />
 24            <PropertyColumn Property="x => x.AverageNote.Format()" Title="Média" />
 25            <TemplateColumn CellClass="d-flex justify-end">
 26                <CellTemplate>
 027                    <MudIconButton Size="@Size.Small" Icon="@Icons.Material.Filled.StickyNote2" OnClick="@(() => AddNote
 28                </CellTemplate>
 29            </TemplateColumn>
 30        </Columns>
 31        <NoRecordsContent>
 32            @(GetNotFoundMessage())
 33        </NoRecordsContent>
 34        <PagerContent>
 35        </PagerContent>
 36    </MudDataGrid>
 37</MudContainer>
 38
 039<AddExamGradeNotesDialog @ref="@_dialog" AfterSubmit="@Load" />
 040
 041@inject GetTeacherClassClient GetTeacherClassClient
 042
 043@code
 044{
 45  [Parameter]
 046  public Guid ClassId { get; set; }
 47
 48    private AddExamGradeNotesDialog _dialog;
 49
 50    private bool _loading;
 51    private string _searchString;
 052    private TeacherClassOut _class = new();
 053    private List<TeacherClassStudentOut> _students = [];
 54
 55    protected override async Task OnInitializedAsync()
 56    {
 057        await Load();
 058    }
 59
 60    private async Task Load()
 61    {
 062        _loading = true;
 063        _class = await GetTeacherClassClient.Get(ClassId);
 064        _students = _class.Students.OrderBy(x => x.Name).ToList();
 065        _loading = false;
 066    }
 67
 68    private async Task AddNote(TeacherClassStudentOut item)
 69    {
 070        await _dialog.Open(item);
 071    }
 72
 073    private Func<TeacherClassStudentOut, bool> _quickFilter => x => _searchString.IsIn(x.Name);
 74
 75    private string GetNotFoundMessage()
 76    {
 077        return (_searchString.IsEmpty()) ? "Não existem alunos matriculados ainda." : "Nenhum aluno encontrado.";
 78    }
 79}