diff --git a/docker-compose.yml b/docker-compose.yml index 173ed61f91afd3cdf6f77b3acdd5dd2507c06b11..57070719d5e6b265ed16529bc48b5c1d3c1f8c79 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,5 +8,5 @@ services: ASSIGNMENT_TITLE: "Assignment Title" SCORE_DEFAULT: 100 LATE_PENALTY: 8 - DEFAULT_POINTS: "[[10],[15,20],[0]]" - DEFAULT_LABELS: "['Name', 'Steps', 'Extra Credit']" \ No newline at end of file + DEFAULT_POINTS: '[[10],[15,20],[0]]' + DEFAULT_LABELS: '["Names", "Steps", "Extra Credit"]' \ No newline at end of file diff --git a/main.py b/main.py index 1d2e11795b7f2c7fd285b43c1a6868a6e0db9103..e789a97366a5dd41a554b24663dcdb4056afa0f2 100644 --- a/main.py +++ b/main.py @@ -5,6 +5,7 @@ from time import sleep import os import json +import numpy """ @@ -28,11 +29,20 @@ Environment Variable Imports """ title = os.getenv("ASSIGNMENT_TITLE", default="Assignment Title") -scoreDefault = os.getenv("SCORE_DEFAULT", default=100) # What the score is out of +scoreDefault = int(os.getenv("SCORE_DEFAULT", default="100")) # What the score is out of latePenalty = int(os.getenv("LATE_PENALTY", default="8")) -# defaults = os.getenv("POINTS_FOR_RUNS", default=[10,20,0]) + + defaults_env = os.getenv("DEFAULT_POINTS", default="[[10],[15,20],[0]]") -defaults = json.loads(defaults_env) + +# Generate array for defaults with environment variable +def generateDefaults(): + array = json.loads(defaults_env) # Get array from environment variable + numpy.array(array, dtype=object) # Convert into object array using numpy + return [[int(point) for point in sublist] for sublist in array] # Return 2d int array from sublists + +defaults = generateDefaults() + defaultLabels_env = os.getenv("DEFAULT_LABELS", default='["Name", "Steps", "Extra Credit"]') defaultLabels = json.loads(defaultLabels_env) """ diff --git a/requirements.txt b/requirements.txt index aae234a49171c03e72356c88846fd703d3dffa1b..d171a2523605bac8886b256be6b526009290a353 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ pyfiglet colored -python-dotenv \ No newline at end of file +python-dotenv +numpy \ No newline at end of file