Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Student Allocator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Falmouth Computing
Student Allocator
Commits
2327d9a2
Commit
2327d9a2
authored
3 years ago
by
Joseph Walton-Rivers
Browse files
Options
Downloads
Patches
Plain Diff
Update main.py - allow variables to be passed in via environment variables
parent
fbfe1b11
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#3224
passed
3 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/main.py
+4
-6
4 additions, 6 deletions
server/main.py
with
4 additions
and
6 deletions
server/main.py
+
4
−
6
View file @
2327d9a2
...
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment