Skip to content
Snippets Groups Projects
Commit 2327d9a2 authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers
Browse files

Update main.py - allow variables to be passed in via environment variables

parent fbfe1b11
No related branches found
No related tags found
No related merge requests found
Pipeline #3224 passed
......@@ -10,9 +10,11 @@ import asyncio
import random
import uuid
import re
import os
JWT_SECRET = "PASSWORD4242"
STAFF_PASSWORD = "Falmouth2022"
# FIXME: should support _FILE for secrets
JWT_SECRET = os.environ['ALLOC_JWT_SECRET']
STAFF_PASSWORD = os.environ['ALLOC_STAFF_PW']
GUEST = 0
STUDENT = 1
......@@ -23,7 +25,6 @@ def allocateVariableGroups(students, idealTeamSize=4, minTeamSize=2):
If there are students left over, and there are at least minStudents they get
to be a team. Else, the 'remainder' students are distrubted across teams.
"""
print("variable allocation: ", idealTeamSize, minTeamSize)
random.shuffle( students )
groups = []
......@@ -59,16 +60,13 @@ def allocateFixedGroups(students, numGroups, minSize = 1):
enouph students for numGroups, then the maximum number
of groups to still satify numGroups is used.
"""
print("fixed allocation: ", numGroups, minSize)
# figure out how many groups we can have
maxPossibleGroups = len(students) // minSize
numGroups = min( numGroups, maxPossibleGroups )
print("fixed: ", numGroups)
if numGroups == 0:
numGroups = 1 # we're having a bad day
print("fixed: ", numGroups)
groups = []
for i in range(0, numGroups):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment