< Summary - Syki

Information
Class: Syki.Front.Features.Teacher.CreateLessonAttendance.ClassLessonsDialog
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Features/Teacher/CreateLessonAttendance/ClassLessonsDialog.razor
Tag: 4_16869239191
Line coverage
0%
Covered lines: 0
Uncovered lines: 26
Coverable lines: 26
Total lines: 89
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
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_MudDialog()100%210%
get_OnRowClick()100%210%
get_Lessons()100%210%
OnInitializedAsync()100%210%
Close()100%210%
HandleRowClick()100%210%

File(s)

/home/runner/work/syki/syki/Front/Features/Teacher/CreateLessonAttendance/ClassLessonsDialog.razor

#LineLine coverage
 1@namespace Syki.Front.Features.Teacher.CreateLessonAttendance
 2
 3<MudDialog>
 4    <TitleContent>
 5        <MudText Typo="Typo.h6">
 6            <MudIcon Icon="@Icons.Material.Filled.Class" Class="mr-1 mb-n1" />
 7            Selecione uma aula
 8        </MudText>
 9    </TitleContent>
 10    <DialogContent>
 11        <MudTable
 12            T="ClassLessonOut"
 13            Items="@Lessons"
 14            Class="mb-4"
 15            Breakpoint="Breakpoint.Sm"
 16            Dense="true"
 17            Hover="true"
 18            RowClass="cursor-pointer"
 19            OnRowClick="@HandleRowClick"
 20            RowsPerPage="100"
 21        >
 22            <HeaderContent>
 23                <MudTh>Aula</MudTh>
 24                <MudTh>Data</MudTh>
 25                <MudTh>Horário</MudTh>
 26                <MudTh>Status</MudTh>
 27                <MudTh>Frequência</MudTh>
 28            </HeaderContent>
 29            <RowTemplate>
 030                <MudTd DataLabel="Aula">@context.Number</MudTd>
 031                <MudTd DataLabel="Data">@context.Date</MudTd>
 032                <MudTd DataLabel="Horário">@context.Schedule</MudTd>
 033                <MudTd DataLabel="Status">@context.Status.GetDescription()</MudTd>
 34                <MudTd DataLabel="Frequência">
 035                    @if (context.Status == ClassLessonStatus.Finalized)
 36                    {
 37                        <MudProgressLinear Color="Color.Primary" Rounded="true" Size="Size.Large" Value="@decimal.ToDoub
 38                            <MudText Typo="Typo.body1">
 039                                <b>@context.Frequency.Format()%</b>
 40                            </MudText>
 41                        </MudProgressLinear>
 42                    }
 43                </MudTd>
 44            </RowTemplate>
 45        </MudTable>
 46    </DialogContent>
 47</MudDialog>
 48
 49@inject IBrowserViewportService BrowserViewportService
 50
 51@code
 52{
 53    [CascadingParameter]
 054    IMudDialogInstance MudDialog { get; set; }
 55
 56    [Parameter]
 057    public EventCallback<Guid> OnRowClick { get; set; }
 58
 59    [Parameter]
 060    public List<ClassLessonOut> Lessons { get; set; } = [];
 61
 62    protected override async Task OnInitializedAsync()
 63    {
 064        await base.OnInitializedAsync();
 65
 066        var breakpoint = await BrowserViewportService.GetCurrentBreakpointAsync();
 067        var options = MudDialog.Options with
 068        {
 069            FullWidth = true,
 070            CloseButton = true,
 071            MaxWidth = MaxWidth.Medium,
 072            FullScreen = breakpoint == Breakpoint.Xs
 073        };
 074        await MudDialog.SetOptionsAsync(options);
 75
 076        Lessons = Lessons.Where(x => x.Date <= DateTime.UtcNow.ToDateOnly()).ToList();
 077    }
 78
 79    private void Close()
 80    {
 081        MudDialog.Cancel();
 082    }
 83
 84    private async Task HandleRowClick(TableRowClickEventArgs<ClassLessonOut> row)
 85    {
 086        Close();
 087        await OnRowClick.InvokeAsync(row.Item.Id);
 088    }
 89}