0
0
Fork 0

Make it so all quotes aren't marked as winners in the brackets

This commit is contained in:
Oliver-Akins 2021-07-19 15:41:21 -06:00
parent 7534cfb4e9
commit b30e8deb68

View file

@ -30,6 +30,7 @@ export default {
// Calculate the winners from the previous bracket // Calculate the winners from the previous bracket
let r = await request.server.inject(`/bracket/winners`); let r = await request.server.inject(`/bracket/winners`);
var quotes: string[] = JSON.parse(r.payload).winners; var quotes: string[] = JSON.parse(r.payload).winners;
var winner_count = quotes.length;
// Ensure that the all elimination limit didn't get hit // Ensure that the all elimination limit didn't get hit
if (quotes.length > Math.floor(config.discord.quote_max / 2)) { if (quotes.length > Math.floor(config.discord.quote_max / 2)) {
@ -53,7 +54,7 @@ export default {
{ {
description: `Note: If **more than ${Math.floor(config.discord.quote_max / 2)}** of the quotes tie, they will all be eliminated, otherwise, the ones that tie will move on to the next bracket.`, description: `Note: If **more than ${Math.floor(config.discord.quote_max / 2)}** of the quotes tie, they will all be eliminated, otherwise, the ones that tie will move on to the next bracket.`,
fields: quotes.map((quote, i) => { return { fields: quotes.map((quote, i) => { return {
name: `${i < quotes.length ? '👑 ' : ''}Quote: ${i + 1}`, name: `${i < winner_count ? '👑 ' : ''}Quote: ${i + 1}`,
value: quote, value: quote,
}}), }}),
} }
@ -70,7 +71,7 @@ export default {
return { return {
label: `Quote ${i + 1}`, label: `Quote ${i + 1}`,
value: i, value: i,
emoji: i < quotes.length ? { emoji: i < winner_count ? {
name: `👑` name: `👑`
} : null } : null
} }