Skip to content

Commit

Permalink
Merge pull request #46 from SSchulze1989/feature/display-irating
Browse files Browse the repository at this point in the history
Feature/display irating
  • Loading branch information
SSchulze1989 authored Mar 19, 2023
2 parents 4516709 + 459cad4 commit 3cbebfc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
15 changes: 15 additions & 0 deletions src/iRLeagueManager.Web/Components/Results/DisplayResult.razor
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
}
<th @onclick="() => SetOrderProperty(Result, row => row.PenaltyPoints)">Penalty</th>
<th @onclick="() => SetOrderProperty(Result, row => row.TotalPoints)">Total Pts.</th>
@if (isTeamResult == false)
{
<th @onclick="() => SetOrderProperty(Result, row => row.OldIrating)">IR (@(EvenStrengthOfField(Result)))</th>
}
<th @onclick="() => SetOrderProperty(Result, row => row.Incidents)">Incs.</th>
</tr>
</thead>
Expand Down Expand Up @@ -85,6 +89,10 @@
@(row.PenaltyPoints != 0 ? $"-{row.PenaltyPoints}" : "")
</td>
<td>@row.TotalPoints</td>
@if (isTeamResult == false)
{
<td>@row.OldIrating</td>
}
<td>@row.Incidents</td>
</tr>
}
Expand All @@ -95,6 +103,8 @@
</div>

@code {
[CascadingParameter]
private EventListViewModel EventList { get; set; } = default!;
[Parameter(CaptureUnmatchedValues = true)]
public IDictionary<string, object>? AdditionalAttributes { get; set; }
[Parameter, EditorRequired]
Expand Down Expand Up @@ -122,4 +132,9 @@
.MinOrDefault();
return rowValue == minValue;
}

private int EvenStrengthOfField(SessionResultViewModel result)
{
return result.EventResult?.StrengthOfField ?? 0;
}
}
3 changes: 2 additions & 1 deletion src/iRLeagueManager.Web/ViewModels/EventResultViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ public EventResultViewModel(ILoggerFactory loggerFactory, LeagueApiService apiSe
base(loggerFactory, apiService)
{
this.model = model;
sessionResults = new ObservableCollection<SessionResultViewModel>(model.SessionResults.Select(x => new SessionResultViewModel(loggerFactory, ApiService, x)));
sessionResults = new ObservableCollection<SessionResultViewModel>(model.SessionResults.Select(x => new SessionResultViewModel(loggerFactory, ApiService, x) { EventResult = this }));
}

public long ResultId => model.ResultId;
public long SeasonId => model.SeasonId;
public long EventId => model.EventId;
public string Name => model.DisplayName;
public int StrengthOfField => model.StrengthOfField;

private ObservableCollection<SessionResultViewModel> sessionResults;
public ObservableCollection<SessionResultViewModel> SessionResults { get => sessionResults; set => Set(ref sessionResults, value); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public SessionResultViewModel(ILoggerFactory loggerFactory, LeagueApiService api
orderByPropertySelector = x => x.FinalPosition;
}

public EventResultViewModel? EventResult { get; set; }
public long SeasonId => model.SeasonId;
public string SessionName => model.SessionName;
public int? SessionNr => model.SessionNr;
Expand Down
2 changes: 1 addition & 1 deletion src/iRLeagueManager.Web/iRLeagueManager.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="Blazored.Modal" Version="7.1.0" />
<PackageReference Include="iRLeagueApiCore.Client" Version="0.5.0" />
<PackageReference Include="iRLeagueApiCore.Common" Version="0.5.0" />
<PackageReference Include="iRLeagueApiCore.Common" Version="0.5.1-dev.1" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.3" />
Expand Down

0 comments on commit 3cbebfc

Please sign in to comment.