From 2fde020a576ac15b67f79e39cc91b5c39254987d Mon Sep 17 00:00:00 2001 From: Sarah Faey Date: Tue, 3 Jan 2023 13:36:21 +0100 Subject: [PATCH] fixed a bug in the randomizer noGproup calculation fixed a bug for signing up external users --- DiscordBot/Messages/ExternalRoleSelectionMessage.cs | 12 +++++++++++- Lieb/Data/RaidRandomizerService.cs | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/DiscordBot/Messages/ExternalRoleSelectionMessage.cs b/DiscordBot/Messages/ExternalRoleSelectionMessage.cs index 7936fee..510e3ad 100644 --- a/DiscordBot/Messages/ExternalRoleSelectionMessage.cs +++ b/DiscordBot/Messages/ExternalRoleSelectionMessage.cs @@ -16,7 +16,17 @@ namespace DiscordBot.Messages foreach(ApiRole role in roles) { if(role.IsSignUpAllowed) - signUpSelect.AddOption(role.Name, role.roleId.ToString(), role.Description); + { + if(!string.IsNullOrEmpty(role.Description)) + { + string description = role.Description.Length <= 100 ? role.Description : role.Description.Substring(0, 100); + signUpSelect.AddOption(role.Name, role.roleId.ToString(), description); + } + else + { + signUpSelect.AddOption(role.Name, role.roleId.ToString(), role.Name); + } + } } var builder = new ComponentBuilder() diff --git a/Lieb/Data/RaidRandomizerService.cs b/Lieb/Data/RaidRandomizerService.cs index 153dadb..789612c 100644 --- a/Lieb/Data/RaidRandomizerService.cs +++ b/Lieb/Data/RaidRandomizerService.cs @@ -110,7 +110,7 @@ namespace Lieb.Data signUp.RaidRole = randomRole; } - int noGroups = (int)Math.Ceiling((double)(raid.SignUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count() / 5)); + int noGroups = (int)Math.Ceiling(raid.SignUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count() / 5.0); HashSet signedUpAccounts = raid.SignUps.Where(s => s.GuildWars2Account != null && s.GuildWars2Account.EquippedBuilds.Where(b => b.GuildWars2Build.UseInRandomRaid).Count() > 0 && s.SignUpType == SignUpType.SignedUp)