Skip to content

Commit 29b467a

Browse files
Merge pull request #107 from FSU-ACM/release
deployment + ui/ux updates
2 parents 035580c + f03ad97 commit 29b467a

38 files changed

+460
-368
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ WORKDIR /app
3636
USER app_user:app_user
3737

3838
COPY --chown=app_user:app_user src .
39-
COPY --chown=app_user:app_user deploy/prod/contestsuite/scripts/*.sh docker/
39+
COPY --chown=app_user:app_user scripts/docker/ docker/
4040

4141
RUN chmod +x docker/*.sh
4242

Pipfile.lock

+114-114
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/dev/scripts/celery/worker/runworker.sh

-4
This file was deleted.

deploy/dev/scripts/django/runserver.sh

-4
This file was deleted.

deploy/prod/contestsuite/docker-swarm.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ services:
4141
- contestsuite_email_user
4242
- contestsuite_email_password
4343
- contestsuite_discord_guild_id
44+
- contestsuite_gtag
4445
environment:
4546
# Django
4647
SECRET_KEY: /run/secrets/contestsuite_django_key # Project secret key
@@ -62,6 +63,9 @@ services:
6263

6364
# Hashid Module
6465
HASHID_FIELD_SALT: /run/secrets/contestsuite_hashid_key # Global Salt
66+
67+
# Analytics
68+
GTAG: /run/secrets/contestsuite_gtag # Google site tag
6569
volumes:
6670
- django_app:/app/media
6771
- django_static:/app/static
@@ -331,6 +335,9 @@ secrets:
331335
external: true
332336
contestsuite_flower_cookie_key:
333337
external: true
338+
# Analytics
339+
contestsuite_gtag:
340+
external: true
334341
volumes:
335342
django_app:
336343
django_db:

requirements-dev.txt

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
-i https://pypi.python.org/simple
2-
astroid==2.14.1 ; python_full_version >= '3.7.2'
2+
astroid==2.14.2 ; python_full_version >= '3.7.2'
33
autopep8==2.0.1
44
dill==0.3.6 ; python_version < '3.11'
55
isort==5.12.0 ; python_full_version >= '3.8.0'
66
lazy-object-proxy==1.9.0 ; python_version >= '3.7'
77
mccabe==0.7.0 ; python_version >= '3.6'
8-
platformdirs==2.6.2 ; python_version >= '3.7'
8+
platformdirs==3.0.0 ; python_version >= '3.7'
99
pycodestyle==2.10.0 ; python_version >= '3.6'
10-
pylint==2.16.1
10+
pylint==2.16.2
1111
tomli==2.0.1 ; python_version < '3.11'
1212
tomlkit==0.11.6 ; python_version >= '3.6'
13-
typing-extensions==4.4.0 ; python_version >= '3.7'
13+
typing-extensions==4.5.0 ; python_version >= '3.7'
1414
wrapt==1.14.1 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
1515
aiohttp==3.7.4.post0 ; python_version >= '3.6'
1616
amqp==5.1.1 ; python_version >= '3.6'
@@ -31,7 +31,7 @@ defusedxml==0.7.1 ; python_version >= '2.7' and python_version not in '3.0, 3.1,
3131
deprecated==1.2.13 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
3232
diff-match-patch==20200713 ; python_version >= '2.7'
3333
discord.py==1.7.3
34-
django==4.1.6
34+
django==4.1.7
3535
django-celery-beat==2.4.0
3636
django-hashid-field==3.3.7
3737
django-import-export==3.0.2
@@ -40,15 +40,15 @@ et-xmlfile==1.1.0 ; python_version >= '3.6'
4040
flower==1.2.0
4141
gunicorn==20.1.0
4242
hashids==1.3.1 ; python_version >= '2.7'
43-
hiredis==2.2.1
43+
hiredis==2.2.2
4444
humanize==4.6.0 ; python_version >= '3.7'
4545
idna==3.4 ; python_version >= '3.5'
4646
kombu==5.2.4 ; python_version >= '3.7'
4747
markuppy==1.14
4848
multidict==6.0.4 ; python_version >= '3.7'
4949
mysqlclient==2.1.1
5050
odfpy==1.4.1
51-
openpyxl==3.1.0
51+
openpyxl==3.1.1
5252
packaging==23.0 ; python_version >= '3.7'
5353
prometheus-client==0.16.0 ; python_version >= '3.6'
5454
prompt-toolkit==3.0.36 ; python_full_version >= '3.6.2'
@@ -58,7 +58,7 @@ pytz==2022.7.1
5858
pyyaml==6.0
5959
redis==4.1.4
6060
requests==2.28.2
61-
setuptools==67.1.0 ; python_version >= '3.7'
61+
setuptools==67.3.2 ; python_version >= '3.7'
6262
six==1.16.0
6363
sqlparse==0.4.3 ; python_version >= '3.5'
6464
tablib[html,ods,xls,xlsx,yaml]==3.3.0 ; python_version >= '3.7'

requirements.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ defusedxml==0.7.1 ; python_version >= '2.7' and python_version not in '3.0, 3.1,
1818
deprecated==1.2.13 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
1919
diff-match-patch==20200713 ; python_version >= '2.7'
2020
discord.py==1.7.3
21-
django==4.1.6
21+
django==4.1.7
2222
django-celery-beat==2.4.0
2323
django-hashid-field==3.3.7
2424
django-import-export==3.0.2
@@ -27,15 +27,15 @@ et-xmlfile==1.1.0 ; python_version >= '3.6'
2727
flower==1.2.0
2828
gunicorn==20.1.0
2929
hashids==1.3.1 ; python_version >= '2.7'
30-
hiredis==2.2.1
30+
hiredis==2.2.2
3131
humanize==4.6.0 ; python_version >= '3.7'
3232
idna==3.4 ; python_version >= '3.5'
3333
kombu==5.2.4 ; python_version >= '3.7'
3434
markuppy==1.14
3535
multidict==6.0.4 ; python_version >= '3.7'
3636
mysqlclient==2.1.1
3737
odfpy==1.4.1
38-
openpyxl==3.1.0
38+
openpyxl==3.1.1
3939
packaging==23.0 ; python_version >= '3.7'
4040
prometheus-client==0.16.0 ; python_version >= '3.6'
4141
prompt-toolkit==3.0.36 ; python_full_version >= '3.6.2'
@@ -45,12 +45,12 @@ pytz==2022.7.1
4545
pyyaml==6.0
4646
redis==4.1.4
4747
requests==2.28.2
48-
setuptools==67.1.0 ; python_version >= '3.7'
48+
setuptools==67.3.2 ; python_version >= '3.7'
4949
six==1.16.0
5050
sqlparse==0.4.3 ; python_version >= '3.5'
5151
tablib[html,ods,xls,xlsx,yaml]==3.3.0 ; python_version >= '3.7'
5252
tornado==6.2 ; python_version >= '3.7'
53-
typing-extensions==4.4.0 ; python_version >= '3.7'
53+
typing-extensions==4.5.0 ; python_version >= '3.7'
5454
tzdata==2022.7 ; python_version >= '2'
5555
urllib3==1.26.14 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
5656
vine==5.0.0 ; python_version >= '3.6'

scripts/celery/worker/runworker.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
export DEBUG=True
4+
exec celery -A ../../src/contestsuite worker -l INFO

scripts/django/runserver.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
export DEBUG=True
4+
exec python3 ../../src/manage.py runserver localhost:8000
File renamed without changes.
File renamed without changes.

src/announcements/templates/announcements/announcement_detail.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{% block section %}Announcements - {{ object.title }}{% endblock %}
1010

1111
{% block content %}
12-
{% cache cache_timeout announcements announcement.slug %}
12+
{% cache CACHE_TIMEOUT announcements announcement.slug %}
1313
<div class="row justify-content-center">
1414
<div class="col">
1515
<div class="card mb-3 mt-3 shadow">

src/announcements/templates/announcements/announcement_list.html

+10-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@
1111
{% block content %}
1212
<h1 class="text-center">Contest Announcements</h1>
1313

14+
<div class="row justify-content-center">
15+
<div class="col-md-9 col-lg-8 mt-3">
16+
<a href="{% url 'announcements_feed' %}" class="btn text-white" title="Announcements RSS feed"
17+
style="background-color: #f3a871;"><i class="fa fa-rss fa-sm fa-fw"></i> Subscribe</a>
18+
</div>
19+
</div>
1420
{% if is_paginated %}
15-
{% cache cache_timeout announcements page_obj.number %}
21+
{% cache CACHE_TIMEOUT announcements page_obj.number %}
1622
<div class="row justify-content-center">
17-
<div class="col-md-8 mt-3 left">
23+
<div class="col-md-9 col-lg-8 mt-3">
1824
{% for announcement in object_list %}
1925
<div class="card mb-4 shadow">
2026
<div class="card-body">
@@ -56,9 +62,9 @@ <h3 class="card-title mb-0">{{ announcement.title }}</h3>
5662

5763
{% endcache %}
5864
{% else %}
59-
{% cache cache_timeout announcements %}
65+
{% cache CACHE_TIMEOUT announcements %}
6066
<div class="row justify-content-center">
61-
<div class="col-md-8 mt-3 left">
67+
<div class="col-md-9 col-lg-8 mt-3">
6268
{% for announcement in object_list %}
6369
<div class="card mb-4 shadow">
6470
<div class="card-body">

src/announcements/views.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from django.views.generic.list import ListView
55

66
from .models import Announcement
7-
from contestsuite.settings import CACHE_TIMEOUT
87

98
# Create your views here.
109

@@ -17,7 +16,7 @@ class AnnouncementListView(ListView):
1716
def get_context_data(self, **kwargs):
1817
context = super().get_context_data(**kwargs)
1918
context['now'] = timezone.now()
20-
context['cache_timeout'] = CACHE_TIMEOUT
19+
2120
return context
2221

2322
def get_queryset(self):
@@ -31,5 +30,5 @@ class AnnouncementDetailView(DetailView):
3130
def get_context_data(self, **kwargs):
3231
context = super().get_context_data(**kwargs)
3332
context['now'] = timezone.now()
34-
context['cache_timeout'] = CACHE_TIMEOUT
33+
3534
return context

src/checkin/templates/checkin/volunteer_checkin.html

+24-17
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,31 @@ <h1 class="text-center">Volunteer Check-in</h1>
1111
{% include 'core/messages.html' %}
1212
<!-- End Messages -->
1313
<div class="row justify-content-center">
14-
<form method="post" id="checkinForm">
15-
{% csrf_token %}
16-
{% for field in volunteer_form %}
17-
<p>
18-
<h5 class="mb-0">{{ field.label_tag }}</h5>
19-
{{ field }}<br>
20-
<small class="form-text text-muted">
21-
{% for error in field.errors %}
22-
<p class="text-monospace font-weight-lighter text-danger mb-0">-{{ error }}</p>
14+
<form method="post">
15+
<div class="card">
16+
<div class="card-body">
17+
{% csrf_token %}
18+
{% for field in volunteer_form %}
19+
<p>
20+
<h5 class="mb-0">{{ field.label_tag }}</h5>
21+
{{ field }}<br>
22+
<small class="form-text text-muted">
23+
{% for error in field.errors %}
24+
<p class="text-monospace font-weight-lighter text-danger mb-0">-{{ error }}</p>
25+
{% endfor %}
26+
{% if field.help_text %}
27+
{{ field.help_text }}
28+
{% endif %}
29+
</small>
30+
</p>
2331
{% endfor %}
24-
{% if field.help_text %}
25-
{{ field.help_text }}
26-
{% endif %}
27-
</small>
28-
</p>
29-
{% endfor %}
30-
<button class="btn btn-sm btn-primary" type="submit">Submit</button>
31-
<a class="btn btn-light btn-sm mx-1" href="{% url 'volunteer_checkin' %}" role="button">Refresh form</a>
32+
</div>
33+
<div class="card-footer">
34+
<button class="btn btn-sm btn-primary" type="submit">Submit</button>
35+
<a class="btn btn-secondary btn-sm mx-1" href="{% url 'volunteer_checkin' %}" role="button">Refresh form</a>
36+
</div>
37+
</div>
38+
3239
</form>
3340
</div>
3441

src/checkin/views.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from django.contrib.admin.views.decorators import staff_member_required
33
from django.contrib.auth.models import User
44
from django.contrib.auth.decorators import login_required, user_passes_test
5+
from django.core.cache import cache
56
from django.db import transaction
67
from django.shortcuts import render, redirect
78

@@ -11,6 +12,7 @@
1112
from . import tasks
1213
from .utils import checkin_auth
1314
from contestadmin.models import Contest
15+
from contestsuite.settings import CACHE_TIMEOUT
1416
from register.models import Team
1517

1618
# Create your views here.
@@ -158,10 +160,8 @@ def volunteer_checkin(request):
158160
except:
159161
messages.error(request, 'Username not found', fail_silently=True)
160162
else:
161-
try:
162-
contest = Contest.objects.first()
163-
except:
164-
contest = None
163+
contest = cache.get_or_set(
164+
'contest_model', Contest.objects.first(), CACHE_TIMEOUT)
165165

166166
if contest is None:
167167
messages.warning(request, 'Unable to verify PIN. Please try again later.', fail_silently=True)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 4.1.6 on 2023-02-09 18:10
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('contestadmin', '0005_contest_lfg_active'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='contest',
15+
name='order_tshirt_url',
16+
field=models.URLField(blank=True, null=True),
17+
),
18+
]

src/contestadmin/models.py

+7
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ class Contest(models.Model):
2828
participation = models.PositiveSmallIntegerField(choices=FORMAT, blank=True, null=True)
2929
lfg_active = models.BooleanField(default=False)
3030
lunch_form_url = models.URLField(blank=True, null=True)
31+
order_tshirt_url = models.URLField(blank=True, null=True)
3132

3233
def __str__(self):
3334
return ("Programming Contest on "+str(self.contest_date))
35+
36+
def get_participation(self):
37+
if self.participation:
38+
return self.FORMAT[self.participation - 1][1]
39+
else:
40+
return 'TBA'

0 commit comments

Comments
 (0)