From 8e48e380c09a324fe289e73f8de54b31d1602d5d Mon Sep 17 00:00:00 2001 From: braker <7152322+araszka@users.noreply.github.com> Date: Sat, 23 Sep 2023 10:37:32 +0200 Subject: [PATCH] Bugfixes alex (#214) Co-authored-by: Alexander Raszka --- .../Services/LiveRankingService.cs | 31 ++++++++----------- .../Templates/Components/PlayerScore.mt | 18 ++--------- .../Templates/LiveRanking.mt | 17 ++-------- .../Services/MatchRankingService.cs | 14 ++++----- .../Templates/Components/PlayerScore.mt | 17 ++-------- .../Templates/MatchRanking.mt | 17 ++-------- .../Templates/SpectatorTargetInfo.mt | 3 -- 7 files changed, 29 insertions(+), 88 deletions(-) diff --git a/src/Modules/LiveRankingModule/Services/LiveRankingService.cs b/src/Modules/LiveRankingModule/Services/LiveRankingService.cs index 52bd64fa5..cd8bc286b 100644 --- a/src/Modules/LiveRankingModule/Services/LiveRankingService.cs +++ b/src/Modules/LiveRankingModule/Services/LiveRankingService.cs @@ -8,9 +8,7 @@ using EvoSC.Manialinks.Interfaces; using EvoSC.Modules.Official.LiveRankingModule.Interfaces; using EvoSC.Modules.Official.LiveRankingModule.Models; -using EvoSC.Modules.Official.LiveRankingModule.Utils; using GbxRemoteNet.Events; -using LinqToDB.Common; using Microsoft.Extensions.Logging; namespace EvoSC.Modules.Official.LiveRankingModule.Services; @@ -73,34 +71,30 @@ public async Task OnPlayerWaypointAsync(WayPointEventArgs args) _logger.LogTrace("Player crossed a checkpoint: {ArgsAccountId} - RoundsMode: {IsRoundsMode}", args.AccountId, _isRoundsMode); - var previousRanking = (await _liveRankingStore.GetFullLiveRankingAsync()).ToList(); + //var previousRanking = (await _liveRankingStore.GetFullLiveRankingAsync()).ToList(); _liveRankingStore.RegisterTime(args.AccountId, args.CheckpointInRace, args.RaceTime, args.IsEndRace); await _manialinkManager.SendPersistentManialinkAsync("LiveRankingModule.LiveRanking", - await GetWidgetData(previousRanking)); + await GetWidgetData()); } } - private async Task GetWidgetData(List? previousRanking = null) + private async Task GetWidgetData() { var currentRanking = (await _liveRankingStore.GetFullLiveRankingAsync()).Take(ShowRows).ToList(); await CalculateDiffs(currentRanking); var widgetCurrentRanking = GetLiveRankingForWidget(currentRanking); - if (previousRanking.IsNullOrEmpty()) + return new { - return new - { - previousRankings = widgetCurrentRanking, - rankingsExisting = new List(), - rankingsNew = new List(), - headerColor = _config.Theme.UI.HeaderBackgroundColor, - primaryColor = _config.Theme.UI.PrimaryColor, - logoUrl = _config.Theme.UI.LogoWhiteUrl, - playerRowBackgroundColor = _config.Theme.UI.PlayerRowBackgroundColor - }; - } + rankings = widgetCurrentRanking, + headerColor = _config.Theme.UI.HeaderBackgroundColor, + primaryColor = _config.Theme.UI.PrimaryColor, + logoUrl = _config.Theme.UI.LogoWhiteUrl, + playerRowBackgroundColor = _config.Theme.UI.PlayerRowBackgroundColor + }; +/* //Map ranking entries for widget var widgetPreviousRanking = GetLiveRankingForWidget(previousRanking.Take(ShowRows).ToList()); @@ -119,6 +113,7 @@ private async Task GetWidgetData(List? pre logoUrl = _config.Theme.UI.LogoWhiteUrl, playerRowBackgroundColor = _config.Theme.UI.PlayerRowBackgroundColor }; + */ } public Task CalculateDiffs(List rankings) @@ -147,7 +142,7 @@ public async Task OnPlayerGiveupAsync(PlayerUpdateEventArgs args) _liveRankingStore.RegisterPlayerGiveUp(args.AccountId); await _manialinkManager.SendPersistentManialinkAsync("LiveRankingModule.LiveRanking", - await GetWidgetData(previousRanking)); + await GetWidgetData()); } } diff --git a/src/Modules/LiveRankingModule/Templates/Components/PlayerScore.mt b/src/Modules/LiveRankingModule/Templates/Components/PlayerScore.mt index 7d95adfc0..959af9f88 100644 --- a/src/Modules/LiveRankingModule/Templates/Components/PlayerScore.mt +++ b/src/Modules/LiveRankingModule/Templates/Components/PlayerScore.mt @@ -2,7 +2,6 @@ - @@ -12,8 +11,8 @@