Skip to content

Commit

Permalink
chore: remove all drop location stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
deadaf committed Sep 2, 2024
1 parent c6c45b7 commit 5efa224
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
13 changes: 8 additions & 5 deletions src/cogs/esports/events/scrims.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
28 changes: 11 additions & 17 deletions src/models/esports/scrims.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -404,9 +398,7 @@ async def reg_open_msg(self):
("<<teamname>>", "Yes" if self.teamname_compulsion else "No"),
(
"<<mention_banned>>",
", ".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()))),
),
(
"<<mention_reserved>>",
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down Expand Up @@ -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)


Expand Down

0 comments on commit 5efa224

Please sign in to comment.