diff --git a/Dockerfile b/Dockerfile index 6c4c443f..f85ce25a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM python:3.10-slim LABEL maintainer="ACM at FSU " -ENV PYTHONUNBUFFERED 1 -ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED=1 +ENV PYTHONDONTWRITEBYTECODE=1 ARG REQUIREMENTS=requirements.txt @@ -30,6 +30,7 @@ RUN pip install --no-cache-dir -r /tmp/requirements.txt \ && install -d -m 0755 -o app_user -g app_user /app/media \ && install -d -m 0755 -o app_user -g app_user /app/media/contest_files \ && install -d -m 0755 -o app_user -g app_user /app/media/ec_files \ + && install -d -m 0755 -o app_user -g app_user /app/media/team_files \ && install -d -m 0755 -o app_user -g app_user /app/media/uploads # Code and User Setup diff --git a/src/contestadmin/forms.py b/src/contestadmin/forms.py index 492664b2..912505b5 100644 --- a/src/contestadmin/forms.py +++ b/src/contestadmin/forms.py @@ -43,12 +43,18 @@ class Meta: model = Profile fields = ["role"] + +class AccountStatusForm(forms.Form): + STATUS = ( + (0, 'Activate'), + (1, 'Deactivate') + ) -class ActivateAccountForm(forms.Form): username = forms.CharField( max_length=150, label='Username', help_text="Person's account username.") + status = forms.ChoiceField(choices=STATUS) class DesignateFacultyTeamForm(forms.Form): @@ -56,3 +62,11 @@ class DesignateFacultyTeamForm(forms.Form): max_length=30, label='Team name', help_text="Name of faculty team.") + + +class UpdatePasswordForm(forms.Form): + username = forms.CharField( + max_length=150, + label='Username', + help_text="Person's account username.") + password = forms.CharField() diff --git a/src/contestadmin/tasks.py b/src/contestadmin/tasks.py index d9e06e16..4f26a85d 100644 --- a/src/contestadmin/tasks.py +++ b/src/contestadmin/tasks.py @@ -266,6 +266,38 @@ def generate_ec_reports(): f'Processed extra credit files for {num_courses} courses') +@shared_task +def generate_team_csvs(): + """ + Celery task which creates CSV files containing team data per division. + """ + + for division in Team.DIVISION: + if division[0] == 1: # Upper + team_file = f"{MEDIA_ROOT}/team_files/upper.csv" + else: # Lower + team_file = f"{MEDIA_ROOT}/team_files/lower.csv" + + with open(team_file, 'w', newline='') as team_csv: + writer = csv.writer( + team_csv, delimiter=',', quoting=csv.QUOTE_MINIMAL) + + # File header + writer.writerow(['team_division', 'team_name', 'questions_answered', 'domjudge_id', 'team_active', 'team_members']) + + # Team data + teams = Team.objects.filter(division=division[0]) + for team in teams: + writer.writerow([ + team.get_division_code(), + team.name, + team.questions_answered, + team.contest_id, + 'T' if team.is_active() else 'F', + '_'.join(team.get_members()) + ]) + + @shared_task def email_faculty(domain): """ diff --git a/src/contestadmin/templates/contestadmin/dashboard.html b/src/contestadmin/templates/contestadmin/dashboard.html index 287b9f2e..efd2e98a 100644 --- a/src/contestadmin/templates/contestadmin/dashboard.html +++ b/src/contestadmin/templates/contestadmin/dashboard.html @@ -25,6 +25,9 @@

Contest Dashboard

Pre-Contest
+
+ +
Generate DOMjudge TSVs {% if dj_files_available %} @@ -73,7 +76,6 @@

Contest Dashboard

- {% if dj_results_processed %} Generate Reports @@ -101,15 +103,34 @@

Contest Dashboard

- Contest Tools + Tools
-
- +
+
+
+ +
+
+ Generate Team CSVs + {% if team_csvs_available %} + + {% else %} + + {% endif %} +
+
+
+
+ +
+
+ +
+
-
- -
+
@@ -142,17 +163,22 @@

Contest Dashboard

- Account Tools + Change User Password
-
-
- +
+
+ {% csrf_token %} +
+ {{ update_password_form.username | placeholder:"Username" }} +
+
+ {{ update_password_form.password | placeholder:"New password" }} +
-
- + -
+
@@ -257,7 +283,6 @@

Contest Dashboard

- - - - -