Skip to content

Commit

Permalink
Merge pull request #564 from battlecode/disabled-auto-ranked-scrimmag…
Browse files Browse the repository at this point in the history
…es-2

Disable auto-accept for ranked scrimmages (and do nothing else)
  • Loading branch information
n8kim1 authored Jan 16, 2023
2 parents 95f354a + 00794a6 commit 0e87545
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 6 additions & 3 deletions backend/siarnaq/api/compete/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ def auto_accept_scrimmage(instance, created, **kwargs):
"""Automatically accept a scrimmage request if the team prefers to do so."""
if not created:
return
if (instance.is_ranked and instance.requested_to.profile.auto_accept_ranked) or (
not instance.is_ranked and instance.requested_to.profile.auto_accept_unranked
):
# if (instance.is_ranked and instance.requested_to.profile.auto_accept_ranked) or (
# not instance.is_ranked and instance.requested_to.profile.auto_accept_unranked
# ):
# NOTE: we disable auto-accept for ranked scrimmages for now.
# Is a hotfix patch, can figure out better solution later.
if not instance.is_ranked and instance.requested_to.profile.auto_accept_unranked:
# Must wait for transaction to complete, so that maps are inserted.
transaction.on_commit(
lambda: ScrimmageRequest.objects.filter(pk=instance.pk).accept()
Expand Down
6 changes: 6 additions & 0 deletions backend/siarnaq/api/compete/test_views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import io
import random
from datetime import timedelta
from unittest import skip
from unittest.mock import mock_open, patch

from django.test import TestCase, override_settings
Expand Down Expand Up @@ -1160,6 +1161,11 @@ def setUp(self):
@patch(
"siarnaq.api.compete.managers.SaturnInvokableQuerySet.enqueue", autospec=True
)
@skip("Code behavior has changed temporarily")
# Skipped for now, as ranked scrimmage requests are never auto-accepted
# regardless of user setting.
# Is a quick fix and subject to change on further discussion.
# See #565.
def test_create_autoaccept(self, enqueue):
self.client.force_authenticate(self.users[0])
self.teams[1].profile.auto_accept_ranked = True
Expand Down

0 comments on commit 0e87545

Please sign in to comment.