From 5efa2240bf5d7b50262bb955fb8ac9f204ebfbcf Mon Sep 17 00:00:00 2001 From: deadaf Date: Mon, 2 Sep 2024 12:14:37 +0530 Subject: [PATCH] chore: remove all drop location stuff --- src/cogs/esports/events/scrims.py | 13 ++++++++----- src/models/esports/scrims.py | 28 +++++++++++----------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/cogs/esports/events/scrims.py b/src/cogs/esports/events/scrims.py index 27082000..f29d59e6 100644 --- a/src/cogs/esports/events/scrims.py +++ b/src/cogs/esports/events/scrims.py @@ -16,7 +16,12 @@ from core import Cog from models import ArrayRemove, AssignedSlot, BanLog, BannedTeam, Scrim, Timer -from ..helpers import before_registrations, cannot_take_registration, check_scrim_requirements, should_open_scrim +from ..helpers import ( + before_registrations, + cannot_take_registration, + check_scrim_requirements, + should_open_scrim, +) class ScrimEvents(Cog): @@ -82,7 +87,7 @@ async def on_scrim_registration(self, message: discord.Message): slot = await AssignedSlot.create( user_id=ctx.author.id, team_name=utils.truncate_string(teamname, 30), - drop_location=utils.truncate_string(drop_location, 30), + # drop_location=utils.truncate_string(drop_location, 30), num=slot_num, jump_url=message.jump_url, message_id=message.id, @@ -129,9 +134,7 @@ async def on_scrim_open_timer_complete(self, timer: Timer): if scrim.toggle is not True or not Day(utils.day_today()) in scrim.open_days: return - if scrim.opened_at and scrim.opened_at.strftime("%d-%b-%Y %I:%M %p") == datetime.now(tz=IST).strftime( - "%d-%b-%Y %I:%M %p" - ): + if scrim.opened_at and scrim.opened_at.strftime("%d-%b-%Y %I:%M %p") == datetime.now(tz=IST).strftime("%d-%b-%Y %I:%M %p"): return # means we are having multiple timers for a single scrim :c shit guild = scrim.guild diff --git a/src/models/esports/scrims.py b/src/models/esports/scrims.py index f4e97311..88327c21 100644 --- a/src/models/esports/scrims.py +++ b/src/models/esports/scrims.py @@ -72,7 +72,7 @@ class Meta: required_lines = fields.SmallIntField(default=0) allow_duplicate_tags = fields.BooleanField(default=True) - require_drop_location = fields.BooleanField(default=False) + # require_drop_location = fields.BooleanField(default=False) assigned_slots: fields.ManyToManyRelation["AssignedSlot"] = fields.ManyToManyField("models.AssignedSlot") reserved_slots: fields.ManyToManyRelation["ReservedSlot"] = fields.ManyToManyField("models.ReservedSlot") @@ -203,11 +203,7 @@ def default_slotlist_format(): async def create_slotlist(self): _slots = await self.cleaned_slots() - desc = "\n".join( - f"Slot {slot.num:02} -> {slot.team_name}" - + (f"( {slot.drop_location} )" if slot.drop_location != "None" else "") - for slot in _slots - ) + desc = "\n".join(f"Slot {slot.num:02} -> {slot.team_name}" for slot in _slots) if len(self.slotlist_format) <= 1: text = str(self.default_slotlist_format().to_dict()) @@ -285,9 +281,7 @@ async def ensure_match_timer(self): if self.match_time != _time: await Scrim.filter(pk=self.pk).update(match_time=_time) - check = await Timer.filter( - event="scrim_match", expires=_time, extra={"args": [], "kwargs": {"scrim_id": self.pk}} - ).exists() + check = await Timer.filter(event="scrim_match", expires=_time, extra={"args": [], "kwargs": {"scrim_id": self.pk}}).exists() if not check: await self.bot.reminders.create_timer(_time, "scrim_match", scrim_id=self.pk) @@ -404,9 +398,7 @@ async def reg_open_msg(self): ("<>", "Yes" if self.teamname_compulsion else "No"), ( "<>", - ", ".join( - map(lambda x: getattr(x, "mention", "Left"), map(self.guild.get_member, await self.banned_user_ids())) - ), + ", ".join(map(lambda x: getattr(x, "mention", "Left"), map(self.guild.get_member, await self.banned_user_ids()))), ), ( "<>", @@ -534,9 +526,7 @@ async def close_registration(self): if self.autodelete_extras: msg_ids = (i.message_id for i in registered) - check = lambda x: all( - (not x.pinned, not x.reactions, not x.embeds, not x.author == self.bot.user, not x.id in msg_ids) - ) + check = lambda x: all((not x.pinned, not x.reactions, not x.embeds, not x.author == self.bot.user, not x.id in msg_ids)) self.bot.loop.create_task(wait_and_purge(registration_channel, check=check, wait_for=60)) slotm = await ScrimsSlotManager.get_or_none(guild_id=self.guild_id, scrim_ids__contains=self.id) @@ -554,7 +544,11 @@ async def __add_role_to_reserved_users(self, member_ids: set[int]): continue async def start_registration(self): - from cogs.esports.helpers.utils import available_to_reserve, scrim_work_role, toggle_channel + from cogs.esports.helpers.utils import ( + available_to_reserve, + scrim_work_role, + toggle_channel, + ) oldslots = await self.assigned_slots await AssignedSlot.filter(id__in=(slot.id for slot in oldslots)).delete() @@ -656,7 +650,7 @@ class Meta: num = fields.IntField(null=True) # this will never be null but there are already records in the table so user_id = fields.BigIntField(null=True) team_name = fields.TextField(null=True) - drop_location = fields.CharField(max_length=30, null=True) + # drop_location = fields.CharField(max_length=30, null=True) members = ArrayField(fields.BigIntField(), default=list)