Skip to content

Commit

Permalink
only allow scrimmages against reference player (revert later) (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
acrantel authored Feb 2, 2024
1 parent ba4f7c5 commit e51d9c9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 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 @@ -1246,6 +1247,7 @@ def test_my_none(self):
self.assertEqual(len(response.json()["results"]), 1)


@skip("Skipping tests for forcing scrimmages against only reference player")
class ScrimmageRequestViewSetTestCase(APITransactionTestCase):
"""Test suite for the Scrimmage Requests API."""

Expand Down
4 changes: 4 additions & 0 deletions backend/siarnaq/api/compete/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.conf import settings
from django.db import NotSupportedError, transaction
from django.db.models import Exists, OuterRef, Q, Subquery
from django.http import HttpResponseForbidden
from django.utils import timezone
from drf_spectacular.utils import OpenApiParameter, OpenApiResponse, extend_schema
from rest_framework import mixins, status, viewsets
Expand Down Expand Up @@ -543,6 +544,9 @@ def create(self, request, *, episode_id):
serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)

if serializer.validated_data["requested_to"].pk != 842:
return HttpResponseForbidden()

if serializer.validated_data["is_ranked"]:
active_statuses = {
SaturnStatus.CREATED,
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/scrimmageRequestForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ class ScrimmageRequestForm extends Component {
</button>
</div>
<div className="modal-body">
<p className="text-danger">
Note: only scrimmage requests against Reference Player are
allowed for now. This restriction is to enable our MIT class's
students to submit their bots to pass the class, and will be
removed after Friday.
</p>
<div className="form-group">
<label>Player order</label>
<select
Expand Down

0 comments on commit e51d9c9

Please sign in to comment.