From ad8dc02f5d8bd3e2f342106926111071d9d1abef Mon Sep 17 00:00:00 2001
From: joshrandall8478 <joshrandall8478@gmail.com>
Date: Tue, 22 Oct 2024 20:56:19 -0400
Subject: [PATCH] close to success

---
 .dockerignore            |  5 +++++
 docker-compose.yml       | 12 ++++++++++++
 gradingscript.dockerfile | 17 +++++++++++++++++
 main.py                  | 21 +++++++++++++--------
 4 files changed, 47 insertions(+), 8 deletions(-)
 create mode 100644 .dockerignore
 create mode 100644 docker-compose.yml
 create mode 100644 gradingscript.dockerfile

diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..859a472
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,5 @@
+.venv
+.vscode
+.gitignore
+docker-compose.yml
+gradingscript.Dockerfile
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..173ed61
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,12 @@
+services:
+  app:
+    image: gradingscript:latest
+    build:
+      context: .
+      dockerfile: ./gradingscript.dockerfile
+    environment:
+      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
diff --git a/gradingscript.dockerfile b/gradingscript.dockerfile
new file mode 100644
index 0000000..d368cdb
--- /dev/null
+++ b/gradingscript.dockerfile
@@ -0,0 +1,17 @@
+# Use the official Python image from the Docker Hub
+FROM python:3.9-slim
+
+# Set the working directory in the container
+WORKDIR /app
+
+# Copy the requirements file into the container
+COPY requirements.txt .
+
+# Install the dependencies
+RUN pip3 install --no-cache-dir -r requirements.txt
+
+# Copy the rest of the application code into the container
+COPY . .
+
+# Specify the command to run the application
+CMD ["python3", "main.py"]
\ No newline at end of file
diff --git a/main.py b/main.py
index bc62e72..1d2e117 100644
--- a/main.py
+++ b/main.py
@@ -4,6 +4,7 @@ from colored import Fore, Style #Documentation: https://dslackw.gitlab.io/colore
 from time import sleep
 
 import os
+import json
 
 
 """
@@ -28,8 +29,12 @@ Environment Variable Imports
 
 title = os.getenv("ASSIGNMENT_TITLE", default="Assignment Title")
 scoreDefault = os.getenv("SCORE_DEFAULT", default=100) # What the score is out of
-latePenalty = scoreDefault * float(os.getenv("LATE_PENALTY", default="0.1"))
-defaults = os.getenv("POINTS_FOR_RUNS", default=[10,20,0])
+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)
+defaultLabels_env = os.getenv("DEFAULT_LABELS", default='["Name", "Steps", "Extra Credit"]')
+defaultLabels = json.loads(defaultLabels_env)
 """
  * CHANGEABLE
 """
@@ -43,16 +48,16 @@ defaults = os.getenv("POINTS_FOR_RUNS", default=[10,20,0])
 
 # Default points stored for each run. Each list entry is a run. A default run score of 0 allows extra credit.
 
-defaultLabels = ["Name", "Steps", "Extra Credit"]
+# defaultLabels = ["Name", "Steps", "Extra Credit"]
 
-defaults = [
-    [10],
-    [15,20],
-    [0]]
+# defaults = [
+#     [10],
+#     [15,20],
+#     [0]]
 
 # Late penalty if submission is late. 0 for no penalty
 
-latePenalty = 8 # 10% of score default
+# latePenalty = 8 # 10% of score default
 
 """
 ! NON CHANGEABLE
-- 
GitLab