Skip to content

Commit

Permalink
Merge pull request #388 from aiarena/staging
Browse files Browse the repository at this point in the history
Release v1.6.7
  • Loading branch information
lladdy authored Mar 20, 2022
2 parents c48bba4 + 5f70dd4 commit cfe93f8
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 2 deletions.
8 changes: 8 additions & 0 deletions aiarena/frontend/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ a:hover {
text-align: left;
}

#bot_bio tr:hover a {
color: #86c232;
}

#bot_bio tr:hover a:hover {
color: #ffffff;
}

#bot_wiki_article {
padding: 0 10px 0 10px;
}
Expand Down
11 changes: 10 additions & 1 deletion aiarena/frontend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,9 @@ def get_context_data(self, **kwargs):
context['events'] = events
context['news'] = News.objects.all().order_by('-created')

competitions = Competition.objects.filter(status='open').annotate(num_participants=Count('participations'))
competitions = Competition.objects.filter(
status__in=['frozen','paused','open','closing'])\
.annotate(num_participants=Count('participations'))
# Count active bots of the user in each competition
if self.request.user.is_authenticated:
competitions = (competitions.annotate(n_active_bots=Sum(Case(
Expand Down Expand Up @@ -993,6 +995,13 @@ def label_from_instance(self, bot_object):

class RequestMatchForm(forms.Form):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

# Pre fill the map pool selection, for user convenience
self.initial['map_pool'] = MapPool.objects.filter(id=config.MATCH_REQUESTS_PREFILL_MAP_POOL_ID).first()


MATCHUP_TYPE_CHOICES = (
('specific_matchup', 'Specific Matchup'),
('random_ladder_bot', 'Random Ladder Bot'),
Expand Down
5 changes: 4 additions & 1 deletion aiarena/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
}
}


# Application definition

INSTALLED_APPS = [
Expand Down Expand Up @@ -216,6 +217,8 @@
'MATCH_REQUEST_LIMIT_PLATINUM_TIER': (
2000, 'The periodic limit of match requests for a platinum patreon tier user.'),
'MATCH_REQUEST_LIMIT_DIAMOND_TIER': (8000, 'The periodic limit of match requests for a diamond patreon tier user.'),
'MATCH_REQUESTS_PREFILL_MAP_POOL_ID': (0, 'The ID of the map pool that should be selected by default '
'when requesting matches.'),
'REQUESTED_MATCHES_LIMIT_PERIOD': (
timedelta(days=30), 'The period length for which a user''s match request limit applies.', timedelta),
'BOT_ZIP_SIZE_LIMIT_IN_MB_FREE_TIER': (
Expand Down Expand Up @@ -260,7 +263,7 @@
'Match Requests': ('MATCH_REQUEST_LIMIT_FREE_TIER', 'MATCH_REQUEST_LIMIT_BRONZE_TIER',
'MATCH_REQUEST_LIMIT_SILVER_TIER', 'MATCH_REQUEST_LIMIT_GOLD_TIER',
'MATCH_REQUEST_LIMIT_PLATINUM_TIER', 'MATCH_REQUEST_LIMIT_DIAMOND_TIER',
'REQUESTED_MATCHES_LIMIT_PERIOD',),
'REQUESTED_MATCHES_LIMIT_PERIOD', 'MATCH_REQUESTS_PREFILL_MAP_POOL_ID',),
'File size limits': ('BOT_ZIP_SIZE_LIMIT_IN_MB_FREE_TIER', 'BOT_ZIP_SIZE_LIMIT_IN_MB_BRONZE_TIER',
'BOT_ZIP_SIZE_LIMIT_IN_MB_SILVER_TIER', 'BOT_ZIP_SIZE_LIMIT_IN_MB_GOLD_TIER',
'BOT_ZIP_SIZE_LIMIT_IN_MB_PLATINUM_TIER', 'BOT_ZIP_SIZE_LIMIT_IN_MB_DIAMOND_TIER',),
Expand Down
14 changes: 14 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3.7-slim

RUN apt-get update \
&& apt-get install -y gcc libmariadb-dev

COPY . /app

WORKDIR /app/pip
RUN pip install --upgrade pip
RUN python pip-install.py
RUN pip install -r requirements.txt
RUN pip install -r requirements.DEVELOPMENT.txt

WORKDIR /app
7 changes: 7 additions & 0 deletions docker/local/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# PERSISTENCE LOCAL SETUP
MYSQL_DATABASE=aiarena
MYSQL_USER=aiarena
MYSQL_PASSWORD=aiarena
MYSQL_HOST=aiarena-mysql
MYSQL_PORT=3306
MYSQL_ROOT_PASSWORD=root_password
63 changes: 63 additions & 0 deletions docker/local/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
version: '3.8'

services:

aiarena-redis:
image: redis:latest
container_name: aiarena-redis
restart: unless-stopped
ports:
- "6379:6379"
networks:
- aiarena-network
volumes:
- aiarena-redis-data:/data

aiarena-mysql:
image: mysql:5.7
container_name: aiarena-mysql
restart: unless-stopped
env_file:
- .env
ports:
- "3306:3306"
networks:
- aiarena-network
volumes:
- ./mysql/custom_init.sql:/docker-entrypoint-initdb.d/1.sql
- aiarena-mysql-data:/var/lib/mysql

aiarena-web:
build:
dockerfile: ./docker/Dockerfile
context: ../../
container_name: aiarena-web
restart: unless-stopped
env_file:
- .env
ports:
- "8000:8000"
networks:
- aiarena-network
volumes:
- aiarena-web-data:/data
- ../.:/app
depends_on:
- aiarena-redis
- aiarena-mysql
command: >
sh -c "python /app/manage.py collectstatic --noinput &&
python /app/manage.py migrate &&
python /app/manage.py runserver 0.0.0.0:8000"
volumes:
aiarena-redis-data:
name: aiarena-redis-data
aiarena-mysql-data:
name: aiarena-mysql-data
aiarena-web-data:
name: aiarena-web-data

networks:
aiarena-network:
3 changes: 3 additions & 0 deletions docker/local/mysql/custom_init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE DATABASE aiarena;
CREATE USER aiarena IDENTIFIED BY 'aiarena';
GRANT ALL PRIVILEGES ON aiarena.* TO aiarena WITH GRANT OPTION;

0 comments on commit cfe93f8

Please sign in to comment.