From 550b52cabdbbc19a661998f88af6a721e98c8fe3 Mon Sep 17 00:00:00 2001 From: Ben C Date: Sun, 14 Nov 2021 11:27:25 -0500 Subject: [PATCH] Cleaned up code and removed SpellChecking inspections --- CodeReview/load_env.py | 2 +- CodeReview/settings.py | 36 +-- CodeReview/wsgi.py | 1 + Instructor/apps.py | 4 + .../static/js/rubrics/rubric-create-widget.js | 4 +- .../static/js/rubrics/rubric-grade-widget.js | 6 +- Instructor/static/js/user-list.js | 4 +- Instructor/templates/admin_home.html | 2 +- Instructor/templates/user_list.html | 103 ++++--- .../templates/widgets/rubric_create.html | 6 +- Main/static/img/fav/browserconfig.xml | 11 +- Main/static/img/fav/manifest.json | 78 ++--- Main/static/img/logo.svg | 286 +++++++++--------- Main/static/js/base.js | 8 +- Main/static/js/form.js | 27 +- Main/templates/base.html | 13 +- Main/templates/delete_base.html | 7 +- Main/templates/emails/email_base.html | 24 +- Main/templates/favicon-data.html | 2 +- Main/templates/reviews/review_view.html | 3 +- Main/templates/reviews/reviews_completed.html | 22 +- Users/templates/widgets/partial-input.html | 2 +- coverage.svg | 28 +- 23 files changed, 379 insertions(+), 300 deletions(-) diff --git a/CodeReview/load_env.py b/CodeReview/load_env.py index 09e0ebc..4c64a58 100644 --- a/CodeReview/load_env.py +++ b/CodeReview/load_env.py @@ -1,5 +1,5 @@ """ - This file s used to load environment variables from a powershell file + This file is used to load environment variables from a powershell file """ import os diff --git a/CodeReview/settings.py b/CodeReview/settings.py index 3662034..1305f2d 100644 --- a/CodeReview/settings.py +++ b/CodeReview/settings.py @@ -20,7 +20,6 @@ DEBUG = STAGE != "Prod" # This option is used in encryption, if we're debugging, we don't care that people know what it is # But, if we're in Production, we'll load the key from the environment -# noinspection SpellCheckingInspection SECRET_KEY = 'django-insecure-1&=3d#^^j*!8)r5y8tuh(t#rp6*(jwbx%90k-ir5c*2j4$s$o%' if DEBUG else os.getenv("SECRET_KEY") # This option defines what url someone can type in to access this site. If we're debugging, it doesn't matter @@ -81,7 +80,7 @@ WSGI_APPLICATION = 'CodeReview.wsgi.application' # This next block of code defines how our database will work and what database system will work if STAGE == "Prod": - # In production, we use MySQl as our database backend + # In production, we use MySQL as our database backend DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', @@ -113,29 +112,15 @@ else: } } -# This option defines what password validation functions to use -AUTH_PASSWORD_VALIDATORS = [ - { - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', - }, -] - # This option defines what backends we use for authentication if DEBUG: + # If we're in development, we add django's model backend so that way we can debug AUTHENTICATION_BACKENDS = [ 'Users.ldap_auth.LDAPAuthentication', 'django.contrib.auth.backends.ModelBackend', ] else: + # If we're in production, we only want to allow authentication through LDAP AUTHENTICATION_BACKENDS = [ 'Users.ldap_auth.LDAPAuthentication', ] @@ -192,7 +177,7 @@ USE_I18N = False USE_L10N = False USE_TZ = False -# These options define urls for static urls +# These options define urls and folders for static files STATIC_URL = '/static/' STATIC_ROOT = os.getenv("STATIC_DIR", "collected-static") @@ -200,7 +185,7 @@ STATIC_ROOT = os.getenv("STATIC_DIR", "collected-static") DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' if not DEBUG: - # If we're in production, all messages will go to a local file named "django_log.txt" + # If we're in production, all messages will go to a local file named "django_logs.txt" LOGGING = { 'version': 1, 'disable_existing_loggers': False, @@ -211,13 +196,10 @@ if not DEBUG: 'filename': 'django_logs.txt', }, }, - 'loggers': { - 'django': { - 'handlers': ['file'], - 'level': 'WARNING', - 'propagate': True, - }, - }, + 'root': { + 'handlers': ['file'], + 'level': 'WARNING' + } } if STAGE == "Prod" and os.getenv("SECURITY", "NONE") == "SECURE": diff --git a/CodeReview/wsgi.py b/CodeReview/wsgi.py index 1092b8b..679b012 100644 --- a/CodeReview/wsgi.py +++ b/CodeReview/wsgi.py @@ -1,5 +1,6 @@ """ This file exposes the WSGI callable as a module-level variable named 'application'. + It acts as the entrypoint of the site, we point the front-end webserver to this file """ import os diff --git a/Instructor/apps.py b/Instructor/apps.py index f55e7ea..c9bde0a 100644 --- a/Instructor/apps.py +++ b/Instructor/apps.py @@ -6,5 +6,9 @@ from django.apps import AppConfig class InstructorConfig(AppConfig): + """ + This class defines configuration data for the Instructor app + """ + default_auto_field = 'django.db.models.BigAutoField' name = 'Instructor' diff --git a/Instructor/static/js/rubrics/rubric-create-widget.js b/Instructor/static/js/rubrics/rubric-create-widget.js index 8a4c419..7e27729 100644 --- a/Instructor/static/js/rubrics/rubric-create-widget.js +++ b/Instructor/static/js/rubrics/rubric-create-widget.js @@ -1,3 +1,5 @@ +'use strict'; + /** * This file is used when creating or editing a rubric */ @@ -154,6 +156,6 @@ $(document).ready(() => { $(".form").submit(submit_callback); - convert_from_json($(".rubric_create_input").val()) + convert_from_json($(".rubric_create_input").val()); }); \ No newline at end of file diff --git a/Instructor/static/js/rubrics/rubric-grade-widget.js b/Instructor/static/js/rubrics/rubric-grade-widget.js index 54560f2..17b241e 100644 --- a/Instructor/static/js/rubrics/rubric-grade-widget.js +++ b/Instructor/static/js/rubrics/rubric-grade-widget.js @@ -11,7 +11,7 @@ function update_cell_colors() { $(".rubric-grading td.cell").each(function (index, object) { console.log($(object).children("input:checked").length); - $(object).toggleClass("selected", $(object).children("label").children("input:checked").length > 0) + $(object).toggleClass("selected", $(object).children("label").children("input:checked").length > 0); }); } @@ -49,7 +49,7 @@ function update_total_score(scores) { */ const report = $("#grade_report"); - let report_lst = [] + let report_lst = []; let total = 0; let max = 0; for (let i = 0; i < scores.length; i++) { @@ -82,7 +82,7 @@ function score_cell_callback(event) { $(event.target).children('label').children(".score-select").click(); } -$(document).ready(function() { +$(document).ready(function () { /** * This function runs when the document has been loaded successfully, diff --git a/Instructor/static/js/user-list.js b/Instructor/static/js/user-list.js index e669c3d..7ea3ef1 100644 --- a/Instructor/static/js/user-list.js +++ b/Instructor/static/js/user-list.js @@ -1,3 +1,5 @@ +'use strict'; + /* This file is used in the user list page for user cleanup */ function cleanupSubmitClick() { @@ -11,7 +13,7 @@ function cleanupSubmitClick() { $("#cleanupForm").submit(); } -$(document).ready(function (){ +$(document).ready(function () { /** * This function will run when the document has loaded * It sets up the cleanupSubmit button's click callback. diff --git a/Instructor/templates/admin_home.html b/Instructor/templates/admin_home.html index c924c6b..e1da5a3 100644 --- a/Instructor/templates/admin_home.html +++ b/Instructor/templates/admin_home.html @@ -1,7 +1,7 @@ {% extends "admin_base.html" %} {% comment %} - This page is the home for Intructor, where they can view ongoing and completed reviews for each section + This page is the home for the intructor, where they can view ongoing and completed reviews for each session {% endcomment %} {% block pageHeader %}Instructor Home{% endblock %} diff --git a/Instructor/templates/user_list.html b/Instructor/templates/user_list.html index bfb79ed..48cb569 100644 --- a/Instructor/templates/user_list.html +++ b/Instructor/templates/user_list.html @@ -15,45 +15,52 @@ {% block containerClass %}container{% endblock %} {% block mainContent %} -