From ca5a6c596c75d5190b89f85bbc9d797c686b7b5d Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sat, 18 May 2024 00:04:52 +0100 Subject: Allow for more than 3 nomination votes if others are ticketed This changes how we calculate whether we are ready for another vote in the talentpool autonomination system. Instead of hard-locking at 3 votes in the pool, we factor in whether an admin-task has been created for the vote (signified by a reaction with the :ticket: emoji). We allow for up to 10 votes to be in the pool total, which in theory allows 3 active votes and 7 votes waiting on the admin-task completion (though we should never hit this threshold realistically). This should allow for voting to be more or less continuous and ensure there is always new votes in the pool and we are not blocked on the completion of a Helpering/waiting for a Helper candidate to be available for a new vote to start. The thresholds are based on those suggested in the nomination-discussion moderator channel. --- bot/exts/recruitment/talentpool/_review.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/bot/exts/recruitment/talentpool/_review.py b/bot/exts/recruitment/talentpool/_review.py index fc48809c0..0d43de4d2 100644 --- a/bot/exts/recruitment/talentpool/_review.py +++ b/bot/exts/recruitment/talentpool/_review.py @@ -33,6 +33,8 @@ MAX_EMBED_SIZE = 4000 # Maximum number of active reviews MAX_ONGOING_REVIEWS = 3 +# Maximum number of total reviews +MAX_TOTAL_REVIEWS = 10 # Minimum time between reviews MIN_REVIEW_INTERVAL = timedelta(days=1) # Minimum time between nomination and sending a review @@ -100,7 +102,9 @@ class Reviewer: else: log.info("Date of last vote not found in cache, a vote may be sent early") - review_count = 0 + ongoing_count = 0 + total_count = 0 + async for msg in voting_channel.history(): # Try and filter out any non-review messages. We also only want to count # one message from reviews split over multiple messages. We use fixed text @@ -108,10 +112,22 @@ class Reviewer: if not msg.author.bot or "for Helper!" not in msg.content: continue - review_count += 1 + total_count += 1 + + is_ticketed = False + for reaction in msg.reactions: + if reaction.emoji == "\N{TICKET}": + is_ticketed = True - if review_count >= MAX_ONGOING_REVIEWS: - log.debug("There are already at least %s ongoing reviews, cancelling check.", MAX_ONGOING_REVIEWS) + if not is_ticketed: + ongoing_count += 1 + + if ongoing_count >= MAX_ONGOING_REVIEWS or total_count >= MAX_TOTAL_REVIEWS: + log.debug( + "There are %s ongoing and %s total reviews, above thresholds of %s and %s", + ongoing_count, total_count, + MAX_ONGOING_REVIEWS, MAX_TOTAL_REVIEWS + ) return False return True -- cgit v1.2.3