Skip to content

Commit

Permalink
Fix incorrect booster queue status messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Citrinate committed Sep 7, 2024
1 parent 3dbd30b commit 59fa68d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion BoosterManager/Boosters/BoosterJobUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ internal static List<uint> RemoveAllBoosters(this IEnumerable<BoosterJob> jobs)
}

internal static Booster? GetBooster(this IEnumerable<BoosterJob> 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<BoosterJob> jobs, uint gameID) {
Expand Down
5 changes: 3 additions & 2 deletions BoosterManager/Handlers/BoosterHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}
}

Expand Down

0 comments on commit 59fa68d

Please sign in to comment.