From 59fa68d46b4adb18a4b44792a499cf397a83436a Mon Sep 17 00:00:00 2001 From: Citrinate Date: Sat, 7 Sep 2024 18:33:42 -0400 Subject: [PATCH] Fix incorrect booster queue status messages --- BoosterManager/Boosters/BoosterJobUtilities.cs | 2 +- BoosterManager/Handlers/BoosterHandler.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/BoosterManager/Boosters/BoosterJobUtilities.cs b/BoosterManager/Boosters/BoosterJobUtilities.cs index c4005a3..f8b0c92 100644 --- a/BoosterManager/Boosters/BoosterJobUtilities.cs +++ b/BoosterManager/Boosters/BoosterJobUtilities.cs @@ -109,7 +109,7 @@ internal static List RemoveAllBoosters(this IEnumerable jobs) } internal static Booster? GetBooster(this IEnumerable jobs, uint gameID) { - return jobs.ToList().Select(job => job.GetBooster(gameID)).FirstOrDefault(); + return jobs.ToList().Select(job => job.GetBooster(gameID)).FirstOrDefault(booster => booster != null); } internal static int GetNumUnqueuedBoosters(this IEnumerable jobs, uint gameID) { diff --git a/BoosterManager/Handlers/BoosterHandler.cs b/BoosterManager/Handlers/BoosterHandler.cs index 916cb74..e4e72e5 100644 --- a/BoosterManager/Handlers/BoosterHandler.cs +++ b/BoosterManager/Handlers/BoosterHandler.cs @@ -265,12 +265,13 @@ internal string GetStatus(bool shortStatus = false) { // Short status int limitedNumBoosters = Jobs.Limited().NumBoosters(); + int limitedNumUncraftedBoosters = Jobs.Limited().NumUncrafted(); int limitedGemsNeeded = Jobs.Limited().GemsNeeded(); if (shortStatus) { if (limitedLastBoosterCraftTime!.Value.Date == DateTime.Today) { - return Commands.FormatBotResponse(Bot, String.Format(Strings.QueueStatusShort, limitedNumBoosters, String.Format("{0:N0}", limitedGemsNeeded), String.Format("{0:t}", limitedLastBoosterCraftTime))); + return Commands.FormatBotResponse(Bot, String.Format(Strings.QueueStatusShort, limitedNumUncraftedBoosters, String.Format("{0:N0}", limitedGemsNeeded), String.Format("{0:t}", limitedLastBoosterCraftTime))); } else { - return Commands.FormatBotResponse(Bot, String.Format(Strings.QueueStatusShortWithDate, limitedNumBoosters, String.Format("{0:N0}", limitedGemsNeeded), String.Format("{0:d}", limitedLastBoosterCraftTime), String.Format("{0:t}", limitedLastBoosterCraftTime))); + return Commands.FormatBotResponse(Bot, String.Format(Strings.QueueStatusShortWithDate, limitedNumUncraftedBoosters, String.Format("{0:N0}", limitedGemsNeeded), String.Format("{0:d}", limitedLastBoosterCraftTime), String.Format("{0:t}", limitedLastBoosterCraftTime))); } }