Skip to content

Commit

Permalink
Refactor jump history handling to ensure ordered retrieval in Overvie…
Browse files Browse the repository at this point in the history
…w component (#328)
  • Loading branch information
pfh59 authored Dec 19, 2024
1 parent 2da929c commit ba0732d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/WHMapper/Pages/Mapper/LinkInfos/Overview.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public partial class Overview : ComponentBase
private string FirstJumpLogCharacterName { get; set; } = string.Empty;
private string FirstJumpLogShipName { get; set; } = string.Empty;
private DateTime? FirstJumpLogDate { get; set; } = null;

private string LastJumpLogCharacterName{ get; set; } = string.Empty;
private string LastJumpLogShipName { get; set; } = string.Empty;
private DateTime? LastJumpLogDate { get; set; } = null;
Expand Down Expand Up @@ -62,7 +62,9 @@ private async Task Restore()
SystemLink = await DbSystemLink.GetById(CurrentSystemLink.Id);
if (SystemLink != null)
{
var firstJump = SystemLink.JumpHistory.FirstOrDefault();
var JumpHistory = SystemLink.JumpHistory.OrderBy(x => x.JumpDate).ToList();

var firstJump = JumpHistory.FirstOrDefault();
if(firstJump!=null)
{
_showing=true;
Expand All @@ -71,7 +73,7 @@ private async Task Restore()
FirstJumpLogShipName = await GetJumpLogShipName(firstJump);
}

var lastJump = SystemLink.JumpHistory.LastOrDefault();
var lastJump = JumpHistory.LastOrDefault();
if(lastJump!=null)
{
_showing=true;
Expand Down
2 changes: 1 addition & 1 deletion src/WHMapper/Pages/Mapper/LinkInfos/Overview.razor
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</MudStack>
</MudStack>
</MudStack>
<MudTable Items="@SystemLink?.JumpHistory" Height="calc(100%)" Outlined="true" Dense="true" Hover="false" Bordered=true Striped=true
<MudTable Items="@SystemLink?.JumpHistory.OrderBy(x=>x.JumpDate)" Height="325px" Outlined="true" Dense="true" Hover="false" Bordered=true Striped=true
AllowUnsorted=false SortLabel="Sort By"
Virtualize="true" Loading=@_isLoading LoadingProgressColor="Color.Info">
<HeaderContent>
Expand Down

0 comments on commit ba0732d

Please sign in to comment.