@page "/teams/goals"
@attribute [Authorize]
@using Microsoft.EntityFrameworkCore
@using WebApp.Models
@using WebApp.Components.Shared.Components
@inject IConfiguration Configuration
@inject AppDbContext Context
@if (_students == null)
{
Loading...
}
else
{
@foreach (var student in _students)
{
@student.Name
For each of your events, write down your goals for this competition year.
@foreach (var team in student.Teams.OrderBy(t => t.Event.Name))
{
@team.Event.Name
@if (team.Event.EventFormat == EventFormat.Team)
{
(Team: @string.Join(", ", team.Students.OrderByDescending(e => e.Grade + e.TsaYear).Select(e => e.FirstName)))
}
Goal:
}
}
}
@code {
private Student[]? _students;
protected override async Task OnInitializedAsync()
{
_students =
await Context.Students
.Include(e => e.Teams)
.ThenInclude(e => e.Event)
.Include(e => e.Teams)
.ThenInclude(e => e.Students)
.OrderBy(e => e.FirstName)
.ToArrayAsync();
}
}