From 9c5bd0bc84a86e311518e8351bff2c8baf4df39b Mon Sep 17 00:00:00 2001 From: glek <156453486+Kafui123@users.noreply.github.com> Date: Wed, 10 Sep 2025 16:58:57 +0000 Subject: [PATCH 01/32] Changes to adjustment forms --- .vscode/settings.json | 4 + README.md | 2 +- app.py | 4 +- app/__init__.py | 10 ++- .../admin_routes/adminManagement.py | 2 +- .../admin_routes/allPendingForms.py | 28 +++---- .../admin_routes/emailTemplateController.py | 6 +- .../admin_routes/financialAidOverload.py | 2 +- .../admin_routes/manage_departments.py | 6 +- .../admin_routes/termManagement.py | 6 +- app/controllers/main_routes/alterLSF.py | 6 +- app/controllers/main_routes/laborHistory.py | 8 +- .../main_routes/laborReleaseForm.py | 2 +- .../main_routes/laborStatusForm.py | 8 +- app/controllers/main_routes/main_routes.py | 6 +- .../main_routes/studentOverloadApp.py | 4 +- .../main_routes/studentResponse.py | 5 ++ app/logic/allPendingForms.py | 6 +- app/logic/banner.py | 10 +-- app/logic/emailHandler.py | 8 +- app/logic/statusFormFunctions.py | 6 +- app/logic/userInsertFunctions.py | 6 +- app/login_manager.py | 9 +-- app/static/js/ckeditor/LICENSE.md | 6 +- .../lib/codemirror/codemirror.css | 2 +- app/templates/snips/studentHistoryModal.html | 2 +- database/active_position_reader.py | 80 +++++++++---------- database/add_admins.py | 4 +- database/base_data.py | 8 +- database/demo_data.py | 18 ++--- database/dump-and-scrub.sh | 2 +- database/fix-fall-positions/fix_terms.py | 8 +- database/import-old-data/copy_old_data.py | 18 ++--- database/import-old-data/import_functions.py | 12 +-- database/manual-secondary-fixer.py | 14 ++-- db_test.py | 6 +- scripts/sync_preferred_name.py | 6 +- scripts/updateDBRecords.py | 24 +++--- setup.sh | 2 +- tests/code/test_models.py | 2 +- tests/mail_test.py | 4 +- tests/ui/functional_test.py | 6 +- tests/ui/smoke_test.py | 6 +- 43 files changed, 195 insertions(+), 189 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..e0f4385ba --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "python-envs.pythonProjects": [], + "python-envs.defaultEnvManager": "ms-python.python:system" +} \ No newline at end of file diff --git a/README.md b/README.md index 493e38421..b404cfa85 100755 --- a/README.md +++ b/README.md @@ -69,4 +69,4 @@ If you want to test with actual emails, use an email other than outlook to test 1. Set up two factor authentication on your Gmail (Security Settings) 2. Create an App Password through your Gmail. This 16 character password can only be viewed once, so make sure to save it. (NOTE: You won't have the option to create an app password unless step one is completed) 3. Inside of your secret_config.yaml file set the MAIL_USERNAME and MAIL_DEFAULT_SENDER as your Gmail, set the MAIL_PASSWORD as your new app password as, and set ALWAYS_SEND_MAIL as True. If you want emails to go to their real recipients, remove MAIL_OVERRIDE_ALL from your config or set it to "". -4. For testing purposes, change the email of the student and supervisor to match another email that can receive your test emails (or you can use MAIL_OVERRIDE_ALL to send everything to the address specified. +4. For testing purposes, change the email of the student and supervisor to match another email that can receive your test emails (or you can use MAIL_OVERRIDE_ALL to send everything to the address specified. \ No newline at end of file diff --git a/app.py b/app.py index 3ef0ab230..7f6d7c955 100755 --- a/app.py +++ b/app.py @@ -21,8 +21,8 @@ PORT = 8080 if __name__ == "__main__": - # Print statements go to your log file in production; to your console while developing - print ("Running server at http://{0}:{1}/".format(IP, PORT)) + # statements go to your log file in production; to your console while developing + ("Running server at http://{0}:{1}/".format(IP, PORT)) app.run(host = IP, port = PORT, debug = True, threaded = True) # The next logical place to look is the app/__init__.py file... diff --git a/app/__init__.py b/app/__init__.py index 206a5fc7b..6caa93595 100755 --- a/app/__init__.py +++ b/app/__init__.py @@ -3,7 +3,7 @@ from flask_bootstrap import Bootstrap from playhouse.shortcuts import model_to_dict, dict_to_model - +('#############') app = Flask(__name__) bootstrap = Bootstrap(app) api = Api(app) @@ -18,6 +18,11 @@ if 'use_banner' not in app.config.keys(): app.config['use_banner'] = (app.config['ENV'] in ('production','staging')) +print('############') + + +print("MAIL_OVERRIDE_ALL =", app.config.get("MAIL_OVERRIDE_ALL")) + # Record and output queries if requested from flask import session from peewee import BaseQuery @@ -30,8 +35,7 @@ def new_execute(*args, **kwargs): session['querycount'] += 1 if app.config.get('show_queries'): # in case we selectively disable - print("**Running query {}**".format(session['querycount'])) - print(args[0]) + (args[0]) return old_execute(*args, **kwargs) BaseQuery.execute = new_execute diff --git a/app/controllers/admin_routes/adminManagement.py b/app/controllers/admin_routes/adminManagement.py index 68590cd70..33b898a0b 100644 --- a/app/controllers/admin_routes/adminManagement.py +++ b/app/controllers/admin_routes/adminManagement.py @@ -44,7 +44,7 @@ def adminSearch(): userList = searchForAdmin(rsp) return jsonify(userList) except Exception as e: - print('ERROR Loading Non Labor Admins:', e, type(e)) + ('ERROR Loading Non Labor Admins:', e, type(e)) return jsonify(userList) @admin.route("/adminManagement/userInsert", methods=['POST']) diff --git a/app/controllers/admin_routes/allPendingForms.py b/app/controllers/admin_routes/allPendingForms.py index ef3499db2..349c79b9b 100644 --- a/app/controllers/admin_routes/allPendingForms.py +++ b/app/controllers/admin_routes/allPendingForms.py @@ -160,7 +160,7 @@ def allPendingForms(formType): except DoesNotExist: pass except Exception as e: - print(e) + (e) checkAdjustment(allForms) result = make_response(render_template( @@ -184,7 +184,7 @@ def allPendingForms(formType): except Exception as e: - print("Error Loading all Pending Forms:", e) + ("Error Loading all Pending Forms:", e) return render_template('errors/500.html'), 500 @@ -192,7 +192,7 @@ def allPendingForms(formType): def downloadAllPendingForms(): searchResult = retrieveFormSearchResult(request.form.get('downloadId')) if not searchResult: - print(f"[ERROR] Missing or invalid download id was provided by the user.") + (f"[ERROR] Missing or invalid download id was provided by the user.") abort(500) formHistoryIds = json.loads(searchResult.formHistoryIds) @@ -223,7 +223,7 @@ def approved_and_denied_Forms(): approved_details = modal_approval_and_denial_data(rsp) return jsonify(approved_details) except Exception as e: - print(e) + (e) return jsonify({"Success": False}),500 @admin.route('/admin/skipStudentApproval', methods=['POST']) @@ -264,7 +264,7 @@ def skipStudentApproval(): Notes.create(formID=form.laborStatusFormID, createdBy=g.currentUser, date=date.today(), notesContents=note, noteType = "Labor Note") except Exception as e: - print("Error skipping student approval", e) + ("Error skipping student approval", e) flash("Error skipping student approval. Please try again.","danger") return redirect('/admin/pendingForms/preStudentApproval') @@ -292,7 +292,7 @@ def resendStudentConfirmation(formID): return jsonify({"student_email":formhistory.formID.studentSupervisee.STU_EMAIL}); except Exception as e: - print("Error sending confirmation email. Invalid Form ID.", e) + ("Error sending confirmation email. Invalid Form ID.", e) flash("Error sending confirmation email. Please try again.","danger") abort(500) @@ -314,7 +314,7 @@ def finalUpdateStatus(raw_status): elif raw_status == 'pending': new_status = "Pending" else: - print("Unknown status: ", raw_status) + ("Unknown status: ", raw_status) return jsonify({"success": False}) flash("Forms have been successfully updated.", "success") @@ -348,7 +348,7 @@ def getNotes(formid): return jsonify(notesDict) except Exception as e: - print("Error on getting notes: ", e) + ("Error on getting notes: ", e) return jsonify({"Success": False}) @admin.route('/admin/notesInsert/', methods=['POST']) @@ -376,7 +376,7 @@ def insertNotes(formId): return jsonify({"Success": False}) except Exception as e: - print(e) + (e) return jsonify({"Success": False}), 500 @admin.route('/admin/overloadModal/', methods=['GET']) @@ -452,7 +452,7 @@ def getOverloadModalData(formHistoryID): studentLinks = studentLinks ) except Exception as e: - print("Error Populating Overload Modal:", e) + ("Error Populating Overload Modal:", e) return render_template('errors/500.html'), 500 @admin.route('/admin/releaseModal/', methods=['GET']) @@ -470,7 +470,7 @@ def getReleaseModalData(formHistoryID): noteTotal = noteTotal ) except Exception as e: - print("Error Populating Release Modal:", e) + ("Error Populating Release Modal:", e) return render_template('errors/500.html'), 500 @admin.route('/admin/modalFormUpdate', methods=['POST']) @@ -539,7 +539,7 @@ def modalFormUpdate(): return jsonify({"Success": True}) except Exception as e: - print("Error Updating Release/Overload Forms:", e) + ("Error Updating Release/Overload Forms:", e) return jsonify({"Success": False}),500 @admin.route('/admin/sendVerificationEmail', methods=['POST']) @@ -579,7 +579,7 @@ def sendEmail(): } return jsonify(newEmailInformation) except Exception as e: - print("Error sending verification email to SASS/Financial Aid:", e) + ("Error sending verification email to SASS/Financial Aid:", e) return jsonify({"Success": False}),500 @admin.route('/admin/notesCounter', methods=['POST']) @@ -594,5 +594,5 @@ def getNotesCounter(): noteDictionary = {'noteTotal': noteTotal} return jsonify(noteDictionary) except Exception as e: - print("Error selecting admin notes:", e) + ("Error selecting admin notes:", e) return jsonify({"Success": False}),500 diff --git a/app/controllers/admin_routes/emailTemplateController.py b/app/controllers/admin_routes/emailTemplateController.py index 89b9e06f9..9275b75ac 100644 --- a/app/controllers/admin_routes/emailTemplateController.py +++ b/app/controllers/admin_routes/emailTemplateController.py @@ -45,7 +45,7 @@ def getPurpose(fieldsDictSTR): subjectList.append({"Subject":emailSubjects[0].subject}) return json.dumps(subjectList) except Exception as e: - print("ERROR in getPurpose(): ", e) + ("ERROR in getPurpose(): ", e) return jsonify({"Success": False}), 500 @admin.route('/admin/emailTemplates/getEmail/', methods=['GET']) @@ -57,7 +57,7 @@ def getEmail(fieldsDictSTR): purposeList = {"emailBody": email.body, "emailSubject": email.subject} return json.dumps(purposeList) except Exception as e: - print("ERROR getEmail(): ", e) + ("ERROR getEmail(): ", e) return jsonify({"Success": False}) @admin.route('/admin/emailTemplates/postEmail', methods=['POST']) @@ -71,5 +71,5 @@ def postEmail(): flash(message, "success") return (jsonify({"Success": True})) except Exception as e: - print("ERROR in postEmail: ", e) + ("ERROR in postEmail: ", e) return jsonify({"Success": False}) diff --git a/app/controllers/admin_routes/financialAidOverload.py b/app/controllers/admin_routes/financialAidOverload.py index 6fd1f2b8e..918399042 100644 --- a/app/controllers/admin_routes/financialAidOverload.py +++ b/app/controllers/admin_routes/financialAidOverload.py @@ -120,5 +120,5 @@ def formApproval(status): return jsonify({'success':True}), 200 except Exception as e: - print("Unable to Deny the OverloadForm",type(e).__name__ + ":", e) + ("Unable to Deny the OverloadForm",type(e).__name__ + ":", e) return jsonify({'error': "Unable to Deny the form"}), 500 diff --git a/app/controllers/admin_routes/manage_departments.py b/app/controllers/admin_routes/manage_departments.py index 6b16877cb..027164a22 100644 --- a/app/controllers/admin_routes/manage_departments.py +++ b/app/controllers/admin_routes/manage_departments.py @@ -42,7 +42,7 @@ def manage_departments(): allSupervisors = allSupervisors ) except Exception as e: - print("Error Loading all Departments", e) + ("Error Loading all Departments", e) return render_template('errors/500.html'), 500 @admin.route("/admin/manageDepartments/", methods=['GET']) @@ -82,7 +82,7 @@ def removeSupervisorFromDepartment(): return "False" except Exception as e: - print(f'Could not remove user from department: {e}') + (f'Could not remove user from department: {e}') return "", 500 @admin.route('/admin/complianceStatus', methods=['POST']) @@ -98,5 +98,5 @@ def complianceStatusCheck(): department.save() return jsonify({"Success": True}) except Exception as e: - print(e) + (e) return jsonify({"Success": False}) diff --git a/app/controllers/admin_routes/termManagement.py b/app/controllers/admin_routes/termManagement.py index 69c6373d4..a6c721c63 100644 --- a/app/controllers/admin_routes/termManagement.py +++ b/app/controllers/admin_routes/termManagement.py @@ -92,7 +92,7 @@ def ourDate(): } return jsonify(flasherInfo) except Exception as e: - print("You have failed to update the date.", e) + ("You have failed to update the date.", e) return jsonify({"Success": False}) @@ -113,7 +113,7 @@ def termStatusCheck(): flasherInfo = {'termChanged': term.termName} return jsonify(flasherInfo) except Exception as e: - print(e) + (e) return jsonify({"Success": False}) @admin.route('/termManagement/manageEval', methods=['POST']) @@ -132,5 +132,5 @@ def manageEval(): flasherInfo = {'termChanged': term.termName} return jsonify(flasherInfo) except Exception as e: - print(e) + (e) return jsonify({}, 500) diff --git a/app/controllers/main_routes/alterLSF.py b/app/controllers/main_routes/alterLSF.py index c6edd850a..1c7ee50c6 100644 --- a/app/controllers/main_routes/alterLSF.py +++ b/app/controllers/main_routes/alterLSF.py @@ -72,7 +72,7 @@ def alterLSF(laborStatusKey): try: oldSupervisor = Tracy().getSupervisorFromID(form.supervisor.ID) except InvalidQueryException: - print("The bnumber {} was not found in Supervisor or Tracy", form.supervisor.ID) + ("The bnumber {} was not found in Supervisor or Tracy", form.supervisor.ID) oldSupervisor = {'ID': form.supervisor.ID} notes = Notes.select().where(Notes.formID == laborStatusKey, Notes.noteType == "Supervisor Note") # Gets labor department notes from the laborofficenotes table @@ -158,7 +158,7 @@ def submitAlteredLSF(laborStatusKey): else: email.laborStatusFormAdjusted() except Exception as e: - print("An error occured while attempting to send adjustment form emails: ", e) + ("An error occured while attempting to send adjustment form emails: ", e) message = "Your labor adjustment form(s) for {0} {1} have been submitted.".format(student.studentSupervisee.FIRST_NAME, student.studentSupervisee.LAST_NAME) else: message = "Your labor status form for {0} {1} has been modified.".format(student.studentSupervisee.FIRST_NAME, student.studentSupervisee.LAST_NAME) @@ -170,7 +170,7 @@ def submitAlteredLSF(laborStatusKey): student.studentSupervisee.FIRST_NAME, student.studentSupervisee.LAST_NAME) flash(message, "danger") - print("An error occured during form submission:", e) + ("An error occured during form submission:", e) return jsonify({"Success": False}), 500 diff --git a/app/controllers/main_routes/laborHistory.py b/app/controllers/main_routes/laborHistory.py index 887f15157..da136616a 100755 --- a/app/controllers/main_routes/laborHistory.py +++ b/app/controllers/main_routes/laborHistory.py @@ -96,7 +96,7 @@ def laborhistory(id): except Exception as e: - print("Error Loading Student Labor History", e) + ("Error Loading Student Labor History", e) return render_template('errors/500.html'), 500 @main_bp.route("/laborHistory/download" , methods=['POST']) @@ -107,7 +107,7 @@ def downloadFormHistory(): """ formSearchResults = retrieveFormSearchResult(request.form.get('downloadId')) if not formSearchResults: - print(f"[ERROR] Missing or invalid download ID for student labor history.") + (f"[ERROR] Missing or invalid download ID for student labor history.") return "", 500 formSearchResultIds = json.loads(formSearchResults.formHistoryIds) @@ -189,7 +189,7 @@ def populateModal(statusKey): )) return (resp) except Exception as e: - print("Error on button state: ", e) + ("Error on button state: ", e) message = "An error occured. Contact support using the link at the bottom of the website." flash(message, "danger") return (jsonify({"Success": False})) @@ -244,7 +244,7 @@ def withdraw_form(): return jsonify({"Success":True, "url":"/"}) except Exception as e: - print(e) + (e) message = "An error occured. Your selected form for {0} {1} was not withdrawn.".format(student.studentSupervisee.FIRST_NAME, student.studentSupervisee.LAST_NAME) flash(message, "danger") return jsonify({"Success": False, "url":"/"}) diff --git a/app/controllers/main_routes/laborReleaseForm.py b/app/controllers/main_routes/laborReleaseForm.py index 3b2942666..b7d5f28b9 100755 --- a/app/controllers/main_routes/laborReleaseForm.py +++ b/app/controllers/main_routes/laborReleaseForm.py @@ -65,7 +65,7 @@ def laborReleaseForm(laborStatusKey): return redirect(url_for("main.supervisorPortal")) except Exception as e: - print("Error: ", e) + ("Error: ", e) message = "An error has occurred. Your Labor Release Form for {0} {1} was not submitted.".format(laborStatusForiegnKey.studentSupervisee.FIRST_NAME, laborStatusForiegnKey.studentSupervisee.LAST_NAME) flash(message, "danger") return redirect(url_for("main.supervisorPortal")) diff --git a/app/controllers/main_routes/laborStatusForm.py b/app/controllers/main_routes/laborStatusForm.py index dc794952d..b96530afc 100755 --- a/app/controllers/main_routes/laborStatusForm.py +++ b/app/controllers/main_routes/laborStatusForm.py @@ -79,7 +79,7 @@ def userInsert(): student = getOrCreateStudentRecord(bnumber=rspFunctional[i]['stuBNumber']) supervisor = createSupervisorFromTracy(bnumber=rspFunctional[i]['stuSupervisorID']) except InvalidUserException as e: - print(e) + (e) return "", 500 department, created = Department.get_or_create(DEPT_NAME = rspFunctional[i]['stuDepartment']) @@ -90,12 +90,12 @@ def userInsert(): try: emailDuringBreak(checkForSecondLSFBreak(term.termCode, student.ID), term) except Exception as e: - print("Error when sending emails during break: " + str(e)) + ("Error when sending emails during break: " + str(e)) all_forms.append(True) except Exception as e: all_forms.append(False) - print("ERROR on creating Labor Status Form/Overload Form" + str(e)) + ("ERROR on creating Labor Status Form/Overload Form" + str(e)) flash("Form(s) submitted successfully! They will be eligible for approval in one business day.", "success") return jsonify(all_forms) @@ -201,5 +201,5 @@ def releaseAndRehire(): flash("Form has been successfully released and submitted.", "success") return jsonify({"Success":True}) except Exception as e: - print("Error on release and rehire: ", e) + ("Error on release and rehire: ", e) return jsonify({"Success": False}) diff --git a/app/controllers/main_routes/main_routes.py b/app/controllers/main_routes/main_routes.py index f93ade7a5..a69c8f379 100755 --- a/app/controllers/main_routes/main_routes.py +++ b/app/controllers/main_routes/main_routes.py @@ -88,7 +88,7 @@ def addUserToDept(): return "True" except Exception as e: - print(f'Could not add user to department: {e}') + (f'Could not add user to department: {e}') return "", 500 @main_bp.route('/supervisorPortal/download', methods=['POST']) @@ -99,7 +99,7 @@ def downloadSupervisorPortalResults(): ''' formSearchResults = retrieveFormSearchResult(request.form.get('downloadId')) if not formSearchResults: - print(f"[ERROR] Missing or invalid download ID for form search.") + (f"[ERROR] Missing or invalid download ID for form search.") return "", 500 formSearchResultIds = json.loads(formSearchResults.formHistoryIds) @@ -122,7 +122,7 @@ def submitToBanner(formHistoryId): save_form_status = conn.insert(formHistoryId) except Exception as e: save_form_status = False - print(f"Error saving form history ({formHistoryId}) to Banner.") + (f"Error saving form history ({formHistoryId}) to Banner.") if save_form_status: return "Form successfully submitted to Banner.", 200 diff --git a/app/controllers/main_routes/studentOverloadApp.py b/app/controllers/main_routes/studentOverloadApp.py index 683d95e54..29edab065 100755 --- a/app/controllers/main_routes/studentOverloadApp.py +++ b/app/controllers/main_routes/studentOverloadApp.py @@ -106,7 +106,7 @@ def studentOverloadApp(formHistoryId): def withdrawRequest(formHistoryId): formHistory = FormHistory.get_by_id(formHistoryId) if formHistory.historyType_id != "Labor Overload Form": - print("Somehow we reached a non-overload form history entry ({formHistoryId}) from studentOverloadApp.") + ("Somehow we reached a non-overload form history entry ({formHistoryId}) from studentOverloadApp.") abort(500) # send a withdrawal notification to student and supervisor @@ -163,5 +163,5 @@ def updateDatabase(overloadFormHistoryID): return g.currentUser.student.ID except Exception as e: - print("ERROR: " + str(e)) + ("ERROR: " + str(e)) abort(500) diff --git a/app/controllers/main_routes/studentResponse.py b/app/controllers/main_routes/studentResponse.py index dc436c280..0cf4eacee 100644 --- a/app/controllers/main_routes/studentResponse.py +++ b/app/controllers/main_routes/studentResponse.py @@ -8,8 +8,11 @@ from app.controllers.main_routes import main_bp +print('#####') + @main_bp.route('/studentResponse/confirm', methods=['GET']) def confirm(): + print('####') token = request.args.get('token') # Find the form and make sure the logged in user matches the student on the form @@ -19,6 +22,8 @@ def confirm(): ,LaborStatusForm.studentSupervisee == g.currentUser.student)) try: form = forms.get() + print('###') + print(form) except DoesNotExist as e: flash("This contract is invalid or has expired.", "danger") abort(404) diff --git a/app/logic/allPendingForms.py b/app/logic/allPendingForms.py index 60110d5ef..6d6c9cd5d 100644 --- a/app/logic/allPendingForms.py +++ b/app/logic/allPendingForms.py @@ -73,11 +73,11 @@ def saveStatus(new_status, formHistoryIds, currentUser): overrideOriginalStatusFormOnAdjustmentFormApproval(formHistory, LSF) else: - print("Unable to update form status for formHistoryID {}.".format(id)) + ("Unable to update form status for formHistoryID {}.".format(id)) return jsonify({"success": False}), 500 except Exception as e: - print("Error preparing form for status update:", e) + ("Error preparing form for status update:", e) return jsonify({"success": False}), 500 return jsonify({"success": True}) @@ -160,7 +160,7 @@ def laborAdminOverloadApproval(rsp, historyForm, status, currentUser, currentDat except DoesNotExist: pass except Exception as e: - print(e) + (e) if 'denialReason' in rsp.keys(): # We only update the reject reason if one was given on the UI historyForm.rejectReason = rsp['denialReason'] diff --git a/app/logic/banner.py b/app/logic/banner.py index 7c6daac03..6929b8e25 100644 --- a/app/logic/banner.py +++ b/app/logic/banner.py @@ -16,10 +16,10 @@ def __init__(self): app.config["banner"]["user"], app.config["banner"]["password"], "{url}:{port}/{sid}".format(**app.config["banner"])) - print("BANNER connection initialized. Oracle version {}".format(self.conn.version)) + ("BANNER connection initialized. Oracle version {}".format(self.conn.version)) except Exception as err: - print("BANNER connection failed: {}: {}".format(type(err).__name__, err)) + ("BANNER connection failed: {}: {}".format(type(err).__name__, err)) self.database_exists = False raise err @@ -33,7 +33,7 @@ def query(self, sql): cursor.execute(sql) return cursor.fetchall() except Exception as err: - print("Error querying BANNER db:", err) + ("Error querying BANNER db:", err) return [] return [] @@ -87,10 +87,10 @@ def insert(self, formHistory): cursor = self.conn.cursor() result = cursor.execute(stmt, params) self.conn.commit() - print("Form {} inserted into banner".format(form.laborStatusFormID)) + ("Form {} inserted into banner".format(form.laborStatusFormID)) except Exception as err: - print("Error inserting into BANNER db:", err) + ("Error inserting into BANNER db:", err) return False return True # If we got here, we are successful (even if we didn't even try to insert) diff --git a/app/logic/emailHandler.py b/app/logic/emailHandler.py index 8b5f06f78..917a93ce6 100644 --- a/app/logic/emailHandler.py +++ b/app/logic/emailHandler.py @@ -88,9 +88,9 @@ def __init__(self, formHistoryKey): except Exception as e: # The error you should get when the form is not a release form # is the 'AttributeError' error. We expect to get the 'AttributeError', - # but if we get anything else then we want to print the error + # but if we get anything else then we want to the error if e.__class__.__name__ != "AttributeError": - print (e) + (e) def send(self, message: Message): if app.config['ENV'] == 'production' or app.config['ALWAYS_SEND_MAIL']: @@ -101,14 +101,14 @@ def send(self, message: Message): message.recipients = [app.config['MAIL_OVERRIDE_ALL']] message.reply_to = app.config["REPLY_TO_ADDRESS"] - # print("Debugging emailHandler.py: ", app.config) + # ("Debugging emailHandler.py: ", app.config) self.mail.send(message) elif app.config['ENV'] == 'testing': # TODO: we really should have a way to check that we're sending emails that doesn't spam the logs pass else: - print("ENV: {}. Email not sent to {}, subject '{}'.".format(app.config['ENV'], message.recipients, message.subject)) + ("ENV: {}. Email not sent to {}, subject '{}'.".format(app.config['ENV'], message.recipients, message.subject)) diff --git a/app/logic/statusFormFunctions.py b/app/logic/statusFormFunctions.py index 4694bad63..173cf3de4 100644 --- a/app/logic/statusFormFunctions.py +++ b/app/logic/statusFormFunctions.py @@ -275,13 +275,11 @@ def createOverloadForm(newWeeklyHours, lsf, currentUser, adjustedForm=None, for overloadEmail.LaborOverLoadFormSubmitted(link) except Exception as e: - print("An error occured while attempting to send overload form emails: ", e) + ("An error occured while attempting to send overload form emails: ", e) # This will delete an overload form after the hours are changed elif previousTotalHours > 15 and newTotalHours <= 15: # If we were overloading and now we aren't - print(f"Trying to get formhistory with formID '{lsf.laborStatusFormID}' and history type: 'Labor Overload Form'") - # XXX this breaks if the overload was attached to a different form. ie, this form is the - # primary, but a secondary is what triggered the overload process + (f"Trying to get formhistory with formID '{lsf.laborStatusFormID}' and history type: 'Labor Overload Form'") deleteOverloadForm = FormHistory.get((FormHistory.formID == lsf.laborStatusFormID) & (FormHistory.historyType == "Labor Overload Form")) deleteOverloadForm = OverloadForm.get(OverloadForm.overloadFormID == deleteOverloadForm.overloadForm_id) deleteOverloadForm.delete_instance() # This line also deletes the Form History since it's set to cascade up in the model file diff --git a/app/logic/userInsertFunctions.py b/app/logic/userInsertFunctions.py index 5e77212d3..7a363cba7 100644 --- a/app/logic/userInsertFunctions.py +++ b/app/logic/userInsertFunctions.py @@ -69,7 +69,7 @@ def updateUserFromTracy(user): baseObj.save() except Exception as e: - print( f"We don't want to break our login if an old tracy user doesn't exist or something") + ( f"We don't want to break our login if an old tracy user doesn't exist or something") return user @@ -175,7 +175,7 @@ def createStudentFromTracy(username=None, bnumber=None): try: return Student.get(Student.ID == tracyStudent.ID.strip()) except DoesNotExist: - #print('Could not find {0} {1} in Student table, creating new entry.'.format(tracyStudent.FIRST_NAME, tracyStudent.LAST_NAME)) + #('Could not find {0} {1} in Student table, creating new entry.'.format(tracyStudent.FIRST_NAME, tracyStudent.LAST_NAME)) return Student.create(ID = tracyStudent.ID.strip(), PIDM = tracyStudent.PIDM, legal_name = tracyStudent.FIRST_NAME, @@ -224,5 +224,5 @@ def createSupervisorFromTracy(username=None, bnumber=None): ORG = tracyUser.ORG, DEPT_NAME = tracyUser.DEPT_NAME) except Exception as e: - print(e) + (e) raise InvalidUserException("Error: Could not get or create {0} {1}".format(tracyUser.FIRST_NAME, tracyUser.LAST_NAME)) diff --git a/app/login_manager.py b/app/login_manager.py index 49f67016d..9f6e5374d 100755 --- a/app/login_manager.py +++ b/app/login_manager.py @@ -20,7 +20,7 @@ def logout(): Erases the session and returns the URL for redirection """ if 'username' in session: - print("Logging out", session['username']) + ("Logging out", session['username']) session.clear() url ="/" @@ -34,14 +34,14 @@ def require_login(): try: user = auth_user(env, username) except InvalidUserException as e: - print("Invalid User:", e) + ("Invalid User:", e) return False # Update the user's name user = updateUserFromTracy(user) if 'username' not in session: - print("Logging in as", user.username) + ("Logging in as", user.username) session['username'] = user.username return user @@ -63,13 +63,10 @@ def auth_user(env, username): description = env['description'].lower() supervisor = student = None if description == 'student': - print("Adding {} to student table".format(username)) student = createStudentFromTracy(username) else: - print("Adding {} to supervisor table".format(username)) supervisor = createSupervisorFromTracy(username) - print("Creating record for {} in user table".format(username)) return createUser(username, student=student, supervisor=supervisor) def getOpenTerm(): diff --git a/app/static/js/ckeditor/LICENSE.md b/app/static/js/ckeditor/LICENSE.md index 9ab2d1745..02fdd2d4b 100644 --- a/app/static/js/ckeditor/LICENSE.md +++ b/app/static/js/ckeditor/LICENSE.md @@ -173,14 +173,14 @@ above, provided that you also meet all of these conditions: c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an + interactive use in the most ordinary way, to or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) + does not normally such an announcement, your work based on + the Program is not required to an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, diff --git a/app/static/js/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css b/app/static/js/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css index ceacd1304..e9612408b 100644 --- a/app/static/js/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css +++ b/app/static/js/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css @@ -311,7 +311,7 @@ div.CodeMirror-cursors { /* Used to force a border model for a node */ .cm-force-border { padding-right: .1px; } -@media print { +@media { /* Hide the cursor when printing */ .CodeMirror div.CodeMirror-cursors { visibility: hidden; diff --git a/app/templates/snips/studentHistoryModal.html b/app/templates/snips/studentHistoryModal.html index 8bdca9c6f..69e26cfd9 100755 --- a/app/templates/snips/studentHistoryModal.html +++ b/app/templates/snips/studentHistoryModal.html @@ -6,7 +6,7 @@
- {% if not isAdjustment %} - {% else %} - - {% endif %} + - {% if isAdjustment %} - {% with adjustmentForm=adjustmentForm %} - {% endwith %} - {% else %} {% with overloadForm=overloadForm%} {% include "snips/studentOverloadSubmit.html" %} {% include "snips/studentOverloadWithdraw.html" %} {% endwith %} - {% endif %} +
diff --git a/app/templates/snips/studentOverloadSubmit.html b/app/templates/snips/studentOverloadSubmit.html index dd869bd19..9ca6ca13d 100644 --- a/app/templates/snips/studentOverloadSubmit.html +++ b/app/templates/snips/studentOverloadSubmit.html @@ -14,7 +14,7 @@
Student should not work any hours in this assignment until notificat
diff --git a/database/base_data.py b/database/base_data.py index 7bffa899d..3af2a291f 100644 --- a/database/base_data.py +++ b/database/base_data.py @@ -255,6 +255,9 @@ "action":"Adjusted", "subject":"Labor Status Form Adjusted", "body":''' +

Dear @@Student@@,

+

 

+

Please follow the attached link to verify information needed for the approval of an adjusted form: @@link@@

''', "audience":"Student" }, @@ -264,6 +267,9 @@ "action":"Adjusted", "subject":"Labor Status Form Adjusted", "body":''' +

Dear @@Student@@,

+

 

+

Please follow the attached link to verify information needed for the approval of an adjusted form: @@link@@

''', "audience":"Supervisor" }, From 876dfe3ec2066a37c65b275925ed8005735f6fa0 Mon Sep 17 00:00:00 2001 From: glek <156453486+Kafui123@users.noreply.github.com> Date: Tue, 11 Nov 2025 20:09:53 +0000 Subject: [PATCH 10/32] Updates to the adjustment forms --- .../main_routes/studentOverloadApp.py | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/controllers/main_routes/studentOverloadApp.py b/app/controllers/main_routes/studentOverloadApp.py index ed413cbf4..6cd281263 100755 --- a/app/controllers/main_routes/studentOverloadApp.py +++ b/app/controllers/main_routes/studentOverloadApp.py @@ -148,11 +148,7 @@ def updateDatabase(overloadFormHistoryID): # if status is pending that means we have an adjustment # if status is "pre-student then it means we have an overload" - oldStatus = Status.get( - (Status.statusName == "Pre-Student Approval") | - (Status.statusName == "Pending") | - (Status.statusName == "Approved") - ) + oldStatus = Status.get((Status.statusName == "Pre-Student Approval")) print('Why are not printing') print(oldStatus) @@ -194,10 +190,16 @@ def updateDatabase(overloadFormHistoryID): # Update overload form # this points to none # a query needs to be written to point to the original form that was created. overloadForm = overloadFormHistory.overloadForm - print(overloadFormHistory, "theoverloadformhistory") - print(overloadForm, "theoverloadform") - overloadForm.studentOverloadReason = overloadReason - overloadForm.save() + + if overloadForm is None: + print("⚠️ No overload form found. Creating and linking one...") + overloadForm = OverloadForm.create(studentOverloadReason=overloadReason) + overloadFormHistory.overloadForm = overloadForm + overloadFormHistory.save() + else: + overloadForm.studentOverloadReason = overloadReason + overloadForm.save() + email = emailHandler(overloadFormHistory.formHistoryID) link = makeThirdPartyLink("Financial Aid", request.host, overloadFormHistory.formHistoryID) From f39f1dfeaf8abd5680021686aff4b2be36653b7b Mon Sep 17 00:00:00 2001 From: glek <156453486+Kafui123@users.noreply.github.com> Date: Tue, 11 Nov 2025 20:10:56 +0000 Subject: [PATCH 11/32] Changes --- app/controllers/main_routes/studentOverloadApp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/main_routes/studentOverloadApp.py b/app/controllers/main_routes/studentOverloadApp.py index 6cd281263..875640057 100755 --- a/app/controllers/main_routes/studentOverloadApp.py +++ b/app/controllers/main_routes/studentOverloadApp.py @@ -192,7 +192,7 @@ def updateDatabase(overloadFormHistoryID): overloadForm = overloadFormHistory.overloadForm if overloadForm is None: - print("⚠️ No overload form found. Creating and linking one...") + print(" No overload form found. Creating and linking one...") overloadForm = OverloadForm.create(studentOverloadReason=overloadReason) overloadFormHistory.overloadForm = overloadForm overloadFormHistory.save() From 77b0eae398217b38e9cbe71c462f96debd45d7ea Mon Sep 17 00:00:00 2001 From: glek <156453486+Kafui123@users.noreply.github.com> Date: Wed, 12 Nov 2025 23:27:51 +0000 Subject: [PATCH 12/32] Updates to adjustment reasons --- .../main_routes/studentOverloadApp.py | 49 ++++++++++--------- app/logic/emailHandler.py | 1 - app/templates/main/studentOverloadApp.html | 34 ++++++++++--- database/base_data.py | 2 +- 4 files changed, 56 insertions(+), 30 deletions(-) diff --git a/app/controllers/main_routes/studentOverloadApp.py b/app/controllers/main_routes/studentOverloadApp.py index 875640057..5fcb58974 100755 --- a/app/controllers/main_routes/studentOverloadApp.py +++ b/app/controllers/main_routes/studentOverloadApp.py @@ -91,6 +91,13 @@ def studentOverloadApp(formHistoryId): old_value = adjusted_change.oldValue new_value = adjusted_change.newValue + if field_name == "department": + old_dept = Department.get(Department.ORG == old_value) + new_dept = Department.get(Department.ORG == new_value) + old_value = old_dept.DEPT_NAME + new_value = new_dept.DEPT_NAME + + return render_template( 'main/studentOverloadApp.html', title=('student Overload Application'), username = currentUser, @@ -136,29 +143,25 @@ def withdrawRequest(formHistoryId): @main_bp.route('/studentOverloadApp/update/', methods=['POST']) def updateDatabase(overloadFormHistoryID): try: - print('is this the overload reason####') overloadReason = request.form.get('overloadReason') - print(request.form) - print("did you reach here ") + if not overloadReason: - print("No Overload Reason has been submitted") abort(500) # if status is pending that means we have an adjustment # if status is "pre-student then it means we have an overload" oldStatus = Status.get((Status.statusName == "Pre-Student Approval")) - print('Why are not printing') - print(oldStatus) + newStatus = Status.get(Status.statusName == "Pending") - print("heloooo") + overloadFormHistory = FormHistory.get(FormHistory.formHistoryID == overloadFormHistoryID) - print(overloadFormHistory) - print("heloooo1") + + originalFormHistory = (FormHistory.select() @@ -171,11 +174,10 @@ def updateDatabase(overloadFormHistoryID): ])) ).get() - print(originalFormHistory, "originalFormHistory") + + - print("did you get changes") with mainDB.atomic() as transaction: - print("what about here ") # Update statuses overloadFormHistory.status = newStatus overloadFormHistory.save() @@ -187,18 +189,22 @@ def updateDatabase(overloadFormHistoryID): originalFormHistory.formID.studentConfirmation = True originalFormHistory.formID.save() - # Update overload form - # this points to none # a query needs to be written to point to the original form that was created. - overloadForm = overloadFormHistory.overloadForm - if overloadForm is None: - print(" No overload form found. Creating and linking one...") + overloadForm = overloadFormHistory.overloadForm + + + + if overloadForm is None: overloadForm = OverloadForm.create(studentOverloadReason=overloadReason) - overloadFormHistory.overloadForm = overloadForm - overloadFormHistory.save() - else: - overloadForm.studentOverloadReason = overloadReason + overloadForm.studentOverloadReason = overloadReason + overloadFormHistory.overloadForm = overloadForm + overloadFormHistory.save() + + else: + overloadForm.studentOverloadReason = overloadReason overloadForm.save() + + email = emailHandler(overloadFormHistory.formHistoryID) @@ -209,6 +215,5 @@ def updateDatabase(overloadFormHistoryID): return g.currentUser.student.ID except Exception as e: - print("error please print out") print("ERROR: " + str(e)) abort(500) diff --git a/app/logic/emailHandler.py b/app/logic/emailHandler.py index b168d0993..3678b34ca 100644 --- a/app/logic/emailHandler.py +++ b/app/logic/emailHandler.py @@ -286,7 +286,6 @@ def checkRecipient(self, studentEmailPurpose=False, emailPurpose=False, secondar The method then checks whether to send the email to only the primary or both the primary and secondary supervisors. The method sendEmail is then called to handle the actual sending of the emails. """ - print(studentEmailPurpose, emailPurpose, secondaryEmailPurpose, "please send") if studentEmailPurpose: studentEmail = EmailTemplate.get(EmailTemplate.purpose == studentEmailPurpose) self.sendEmail(studentEmail, "student") diff --git a/app/templates/main/studentOverloadApp.html b/app/templates/main/studentOverloadApp.html index 3e0925918..acfdb98bd 100755 --- a/app/templates/main/studentOverloadApp.html +++ b/app/templates/main/studentOverloadApp.html @@ -123,8 +123,9 @@

Requested Positions

{{primary.formID.termCode.termName}} - {% if field_name == "DEPT_NAME" %} - {{ old_value }} {{ new_value }} + {% if field_name == "department" %} + {{ old_value }}
+ {{ new_value }} {% else %} {{primary.formID.department.DEPT_NAME}} {% endif %} @@ -132,7 +133,8 @@

Requested Positions

{{primary.formID.jobType}} {% if field_name == "POSN_TITLE" %} - {{ old_value }}{{ new_value }} + {{ old_value }}
+ {{ new_value }} {% else %} {{primary.formID.POSN_TITLE}} {% endif %} @@ -152,10 +154,30 @@

Requested Positions

{% for secondary in listSecondary %} {{secondary.formID.termCode.termName}} - {{secondary.formID.department.DEPT_NAME}} + + {% if field_name == "department" %} + {{ old_value }}
+ {{ new_value }} + {% else %} + {{secondary.formID.department.DEPT_NAME}} + {% endif %} + {{secondary.formID.jobType}} - {{secondary.formID.POSN_TITLE}} - {{secondary.formID.weeklyHours}} + + {% if field_name == "POSN_TITLE" %} + {{ old_value }}
+
{{ new_value }} + {% else %} + {{secondary.formID.POSN_TITLE}} + {% endif %} + + + {% if field_name == "weeklyHours" %} + {{ old_value }} {{ new_value }} + {% else %} + {{secondary.formID.weeklyHours}} + {% endif %} + {{secondary.status}} {% endfor %} diff --git a/database/base_data.py b/database/base_data.py index 3af2a291f..3c201f1f1 100644 --- a/database/base_data.py +++ b/database/base_data.py @@ -595,4 +595,4 @@ } ] EmailTemplate.insert_many(emailtemps).on_conflict_replace().execute() -print(" * emailtemplates added") + From b03f14f340ba786ad4b96328a26943506521f8bc Mon Sep 17 00:00:00 2001 From: glek <156453486+Kafui123@users.noreply.github.com> Date: Wed, 12 Nov 2025 23:53:02 +0000 Subject: [PATCH 13/32] Got rid of the print statements --- app/__init__.py | 3 --- app/controllers/main_routes/studentResponse.py | 6 +----- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 6caa93595..f3065a7ec 100755 --- a/app/__init__.py +++ b/app/__init__.py @@ -18,11 +18,8 @@ if 'use_banner' not in app.config.keys(): app.config['use_banner'] = (app.config['ENV'] in ('production','staging')) -print('############') -print("MAIL_OVERRIDE_ALL =", app.config.get("MAIL_OVERRIDE_ALL")) - # Record and output queries if requested from flask import session from peewee import BaseQuery diff --git a/app/controllers/main_routes/studentResponse.py b/app/controllers/main_routes/studentResponse.py index 4eac8db8b..c29cf0d8a 100644 --- a/app/controllers/main_routes/studentResponse.py +++ b/app/controllers/main_routes/studentResponse.py @@ -11,20 +11,16 @@ @main_bp.route('/studentResponse/confirm', methods=['GET']) def confirm(): token = request.args.get('token') - print(token) - print(g.currentUser) - print(g.currentUser.student, "/??") # Find the form and make sure the logged in user matches the student on the form forms = (LaborStatusForm.select() .join(FormHistory) .where(LaborStatusForm.confirmationToken == token ,LaborStatusForm.studentSupervisee == g.currentUser.student)) - print(forms) + try: form = forms.get() except DoesNotExist as e: - print("failed attempt") flash("This contract is invalid or has expired.", "danger") abort(404) From 0a5125d86e780260ef1743ddcb31ad7b2e71b739 Mon Sep 17 00:00:00 2001 From: glek <156453486+Kafui123@users.noreply.github.com> Date: Thu, 13 Nov 2025 01:31:39 +0000 Subject: [PATCH 14/32] added some print statements to get rid of errors --- app/__init__.py | 7 +- .../admin_routes/adminManagement.py | 2 +- .../admin_routes/allPendingForms.py | 28 +++---- .../admin_routes/emailTemplateController.py | 6 +- .../admin_routes/financialAidOverload.py | 2 +- .../admin_routes/manage_departments.py | 6 +- .../admin_routes/termManagement.py | 6 +- app/controllers/main_routes/alterLSF.py | 2 - app/controllers/main_routes/laborHistory.py | 8 +- .../main_routes/laborReleaseForm.py | 2 +- .../main_routes/laborStatusForm.py | 6 +- app/controllers/main_routes/main_routes.py | 6 +- app/logic/allPendingForms.py | 6 +- app/logic/banner.py | 10 +-- app/logic/emailHandler.py | 8 +- app/logic/statusFormFunctions.py | 4 +- app/logic/userInsertFunctions.py | 6 +- app/login_manager.py | 4 +- app/static/js/ckeditor/LICENSE.md | 4 +- database/active_position_reader.py | 74 +++++++++---------- database/add_admins.py | 4 +- database/demo_data.py | 14 ++-- database/dump-and-scrub.sh | 2 +- database/fix-fall-positions/fix_terms.py | 7 +- database/import-old-data/copy_old_data.py | 11 ++- database/import-old-data/import_functions.py | 12 +-- database/manual-secondary-fixer.py | 14 ++-- db_test.py | 2 +- scripts/updateDBRecords.py | 24 +++--- setup.sh | 2 +- tests/mail_test.py | 4 +- tests/ui/functional_test.py | 4 +- tests/ui/smoke_test.py | 4 +- 33 files changed, 148 insertions(+), 153 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index f3065a7ec..387bca08a 100755 --- a/app/__init__.py +++ b/app/__init__.py @@ -3,7 +3,7 @@ from flask_bootstrap import Bootstrap from playhouse.shortcuts import model_to_dict, dict_to_model -('#############') + app = Flask(__name__) bootstrap = Bootstrap(app) api = Api(app) @@ -19,7 +19,6 @@ app.config['use_banner'] = (app.config['ENV'] in ('production','staging')) - # Record and output queries if requested from flask import session from peewee import BaseQuery @@ -31,7 +30,9 @@ def new_execute(*args, **kwargs): session['querycount'] = 0 session['querycount'] += 1 - if app.config.get('show_queries'): # in case we selectively disable + if app.config.get('show_queries'): + print("**Running query {}**".format(session['querycount'])) + print(args[0])# in case we selectively disable (args[0]) return old_execute(*args, **kwargs) BaseQuery.execute = new_execute diff --git a/app/controllers/admin_routes/adminManagement.py b/app/controllers/admin_routes/adminManagement.py index 33b898a0b..68590cd70 100644 --- a/app/controllers/admin_routes/adminManagement.py +++ b/app/controllers/admin_routes/adminManagement.py @@ -44,7 +44,7 @@ def adminSearch(): userList = searchForAdmin(rsp) return jsonify(userList) except Exception as e: - ('ERROR Loading Non Labor Admins:', e, type(e)) + print('ERROR Loading Non Labor Admins:', e, type(e)) return jsonify(userList) @admin.route("/adminManagement/userInsert", methods=['POST']) diff --git a/app/controllers/admin_routes/allPendingForms.py b/app/controllers/admin_routes/allPendingForms.py index 59e01d7e1..37c75bff2 100644 --- a/app/controllers/admin_routes/allPendingForms.py +++ b/app/controllers/admin_routes/allPendingForms.py @@ -160,7 +160,7 @@ def allPendingForms(formType): except DoesNotExist: pass except Exception as e: - (e) + print(e) checkAdjustment(allForms) result = make_response(render_template( @@ -184,7 +184,7 @@ def allPendingForms(formType): except Exception as e: - ("Error Loading all Pending Forms:", e) + print("Error Loading all Pending Forms:", e) return render_template('errors/500.html'), 500 @@ -193,7 +193,7 @@ def downloadAllPendingForms(): currentUser = require_login() searchResult = retrieveFormSearchResult(request.form.get('downloadId')) if not searchResult: - (f"[ERROR] Missing or invalid download id was provided by the user.") + print(f"[ERROR] Missing or invalid download id was provided by the user.") abort(500) formHistoryIds = json.loads(searchResult.formHistoryIds) @@ -224,7 +224,7 @@ def approved_and_denied_Forms(): approved_details = modal_approval_and_denial_data(rsp) return jsonify(approved_details) except Exception as e: - (e) + print(e) return jsonify({"Success": False}),500 @admin.route('/admin/skipStudentApproval', methods=['POST']) @@ -265,7 +265,7 @@ def skipStudentApproval(): Notes.create(formID=form.laborStatusFormID, createdBy=g.currentUser, date=date.today(), notesContents=note, noteType = "Labor Note") except Exception as e: - ("Error skipping student approval", e) + print("Error skipping student approval", e) flash("Error skipping student approval. Please try again.","danger") return redirect('/admin/pendingForms/preStudentApproval') @@ -293,7 +293,7 @@ def resendStudentConfirmation(formID): return jsonify({"student_email":formhistory.formID.studentSupervisee.STU_EMAIL}); except Exception as e: - ("Error sending confirmation email. Invalid Form ID.", e) + print("Error sending confirmation email. Invalid Form ID.", e) flash("Error sending confirmation email. Please try again.","danger") abort(500) @@ -315,7 +315,7 @@ def finalUpdateStatus(raw_status): elif raw_status == 'pending': new_status = "Pending" else: - ("Unknown status: ", raw_status) + print("Unknown status: ", raw_status) return jsonify({"success": False}) flash("Forms have been successfully updated.", "success") @@ -349,7 +349,7 @@ def getNotes(formid): return jsonify(notesDict) except Exception as e: - ("Error on getting notes: ", e) + print("Error on getting notes: ", e) return jsonify({"Success": False}) @admin.route('/admin/notesInsert/', methods=['POST']) @@ -377,7 +377,7 @@ def insertNotes(formId): return jsonify({"Success": False}) except Exception as e: - (e) + print(e) return jsonify({"Success": False}), 500 @admin.route('/admin/overloadModal/', methods=['GET']) @@ -453,7 +453,7 @@ def getOverloadModalData(formHistoryID): studentLinks = studentLinks ) except Exception as e: - ("Error Populating Overload Modal:", e) + print("Error Populating Overload Modal:", e) return render_template('errors/500.html'), 500 @admin.route('/admin/releaseModal/', methods=['GET']) @@ -471,7 +471,7 @@ def getReleaseModalData(formHistoryID): noteTotal = noteTotal ) except Exception as e: - ("Error Populating Release Modal:", e) + print("Error Populating Release Modal:", e) return render_template('errors/500.html'), 500 @admin.route('/admin/modalFormUpdate', methods=['POST']) @@ -540,7 +540,7 @@ def modalFormUpdate(): return jsonify({"Success": True}) except Exception as e: - ("Error Updating Release/Overload Forms:", e) + print("Error Updating Release/Overload Forms:", e) return jsonify({"Success": False}),500 @admin.route('/admin/sendVerificationEmail', methods=['POST']) @@ -581,7 +581,7 @@ def sendEmail(): } return jsonify(newEmailInformation) except Exception as e: - ("Error sending verification email to SASS/Financial Aid:", e) + print("Error sending verification email to SASS/Financial Aid:", e) return jsonify({"Success": False}),500 @admin.route('/admin/notesCounter', methods=['POST']) @@ -596,5 +596,5 @@ def getNotesCounter(): noteDictionary = {'noteTotal': noteTotal} return jsonify(noteDictionary) except Exception as e: - ("Error selecting admin notes:", e) + print("Error selecting admin notes:", e) return jsonify({"Success": False}),500 diff --git a/app/controllers/admin_routes/emailTemplateController.py b/app/controllers/admin_routes/emailTemplateController.py index 9275b75ac..89b9e06f9 100644 --- a/app/controllers/admin_routes/emailTemplateController.py +++ b/app/controllers/admin_routes/emailTemplateController.py @@ -45,7 +45,7 @@ def getPurpose(fieldsDictSTR): subjectList.append({"Subject":emailSubjects[0].subject}) return json.dumps(subjectList) except Exception as e: - ("ERROR in getPurpose(): ", e) + print("ERROR in getPurpose(): ", e) return jsonify({"Success": False}), 500 @admin.route('/admin/emailTemplates/getEmail/', methods=['GET']) @@ -57,7 +57,7 @@ def getEmail(fieldsDictSTR): purposeList = {"emailBody": email.body, "emailSubject": email.subject} return json.dumps(purposeList) except Exception as e: - ("ERROR getEmail(): ", e) + print("ERROR getEmail(): ", e) return jsonify({"Success": False}) @admin.route('/admin/emailTemplates/postEmail', methods=['POST']) @@ -71,5 +71,5 @@ def postEmail(): flash(message, "success") return (jsonify({"Success": True})) except Exception as e: - ("ERROR in postEmail: ", e) + print("ERROR in postEmail: ", e) return jsonify({"Success": False}) diff --git a/app/controllers/admin_routes/financialAidOverload.py b/app/controllers/admin_routes/financialAidOverload.py index 918399042..6fd1f2b8e 100644 --- a/app/controllers/admin_routes/financialAidOverload.py +++ b/app/controllers/admin_routes/financialAidOverload.py @@ -120,5 +120,5 @@ def formApproval(status): return jsonify({'success':True}), 200 except Exception as e: - ("Unable to Deny the OverloadForm",type(e).__name__ + ":", e) + print("Unable to Deny the OverloadForm",type(e).__name__ + ":", e) return jsonify({'error': "Unable to Deny the form"}), 500 diff --git a/app/controllers/admin_routes/manage_departments.py b/app/controllers/admin_routes/manage_departments.py index 027164a22..6b16877cb 100644 --- a/app/controllers/admin_routes/manage_departments.py +++ b/app/controllers/admin_routes/manage_departments.py @@ -42,7 +42,7 @@ def manage_departments(): allSupervisors = allSupervisors ) except Exception as e: - ("Error Loading all Departments", e) + print("Error Loading all Departments", e) return render_template('errors/500.html'), 500 @admin.route("/admin/manageDepartments/", methods=['GET']) @@ -82,7 +82,7 @@ def removeSupervisorFromDepartment(): return "False" except Exception as e: - (f'Could not remove user from department: {e}') + print(f'Could not remove user from department: {e}') return "", 500 @admin.route('/admin/complianceStatus', methods=['POST']) @@ -98,5 +98,5 @@ def complianceStatusCheck(): department.save() return jsonify({"Success": True}) except Exception as e: - (e) + print(e) return jsonify({"Success": False}) diff --git a/app/controllers/admin_routes/termManagement.py b/app/controllers/admin_routes/termManagement.py index a6c721c63..69c6373d4 100644 --- a/app/controllers/admin_routes/termManagement.py +++ b/app/controllers/admin_routes/termManagement.py @@ -92,7 +92,7 @@ def ourDate(): } return jsonify(flasherInfo) except Exception as e: - ("You have failed to update the date.", e) + print("You have failed to update the date.", e) return jsonify({"Success": False}) @@ -113,7 +113,7 @@ def termStatusCheck(): flasherInfo = {'termChanged': term.termName} return jsonify(flasherInfo) except Exception as e: - (e) + print(e) return jsonify({"Success": False}) @admin.route('/termManagement/manageEval', methods=['POST']) @@ -132,5 +132,5 @@ def manageEval(): flasherInfo = {'termChanged': term.termName} return jsonify(flasherInfo) except Exception as e: - (e) + print(e) return jsonify({}, 500) diff --git a/app/controllers/main_routes/alterLSF.py b/app/controllers/main_routes/alterLSF.py index 45a2f298e..ab73c3aa0 100644 --- a/app/controllers/main_routes/alterLSF.py +++ b/app/controllers/main_routes/alterLSF.py @@ -139,8 +139,6 @@ def submitAlteredLSF(laborStatusKey): fieldsChanged = eval(request.data.decode("utf-8")) # This fixes byte indices must be intergers or slices error fieldsChanged = dict(fieldsChanged) student = LaborStatusForm.get(LaborStatusForm.laborStatusFormID == laborStatusKey) - print('###') - print(student) formStatus = (FormHistory.get(FormHistory.formID == laborStatusKey).status_id) formHistoryIDs = [] lsf = LaborStatusForm.get(LaborStatusForm.laborStatusFormID == laborStatusKey) diff --git a/app/controllers/main_routes/laborHistory.py b/app/controllers/main_routes/laborHistory.py index da136616a..887f15157 100755 --- a/app/controllers/main_routes/laborHistory.py +++ b/app/controllers/main_routes/laborHistory.py @@ -96,7 +96,7 @@ def laborhistory(id): except Exception as e: - ("Error Loading Student Labor History", e) + print("Error Loading Student Labor History", e) return render_template('errors/500.html'), 500 @main_bp.route("/laborHistory/download" , methods=['POST']) @@ -107,7 +107,7 @@ def downloadFormHistory(): """ formSearchResults = retrieveFormSearchResult(request.form.get('downloadId')) if not formSearchResults: - (f"[ERROR] Missing or invalid download ID for student labor history.") + print(f"[ERROR] Missing or invalid download ID for student labor history.") return "", 500 formSearchResultIds = json.loads(formSearchResults.formHistoryIds) @@ -189,7 +189,7 @@ def populateModal(statusKey): )) return (resp) except Exception as e: - ("Error on button state: ", e) + print("Error on button state: ", e) message = "An error occured. Contact support using the link at the bottom of the website." flash(message, "danger") return (jsonify({"Success": False})) @@ -244,7 +244,7 @@ def withdraw_form(): return jsonify({"Success":True, "url":"/"}) except Exception as e: - (e) + print(e) message = "An error occured. Your selected form for {0} {1} was not withdrawn.".format(student.studentSupervisee.FIRST_NAME, student.studentSupervisee.LAST_NAME) flash(message, "danger") return jsonify({"Success": False, "url":"/"}) diff --git a/app/controllers/main_routes/laborReleaseForm.py b/app/controllers/main_routes/laborReleaseForm.py index b7d5f28b9..3b2942666 100755 --- a/app/controllers/main_routes/laborReleaseForm.py +++ b/app/controllers/main_routes/laborReleaseForm.py @@ -65,7 +65,7 @@ def laborReleaseForm(laborStatusKey): return redirect(url_for("main.supervisorPortal")) except Exception as e: - ("Error: ", e) + print("Error: ", e) message = "An error has occurred. Your Labor Release Form for {0} {1} was not submitted.".format(laborStatusForiegnKey.studentSupervisee.FIRST_NAME, laborStatusForiegnKey.studentSupervisee.LAST_NAME) flash(message, "danger") return redirect(url_for("main.supervisorPortal")) diff --git a/app/controllers/main_routes/laborStatusForm.py b/app/controllers/main_routes/laborStatusForm.py index b96530afc..d1f97ff31 100755 --- a/app/controllers/main_routes/laborStatusForm.py +++ b/app/controllers/main_routes/laborStatusForm.py @@ -79,7 +79,7 @@ def userInsert(): student = getOrCreateStudentRecord(bnumber=rspFunctional[i]['stuBNumber']) supervisor = createSupervisorFromTracy(bnumber=rspFunctional[i]['stuSupervisorID']) except InvalidUserException as e: - (e) + print(e) return "", 500 department, created = Department.get_or_create(DEPT_NAME = rspFunctional[i]['stuDepartment']) @@ -95,7 +95,7 @@ def userInsert(): all_forms.append(True) except Exception as e: all_forms.append(False) - ("ERROR on creating Labor Status Form/Overload Form" + str(e)) + print("ERROR on creating Labor Status Form/Overload Form" + str(e)) flash("Form(s) submitted successfully! They will be eligible for approval in one business day.", "success") return jsonify(all_forms) @@ -201,5 +201,5 @@ def releaseAndRehire(): flash("Form has been successfully released and submitted.", "success") return jsonify({"Success":True}) except Exception as e: - ("Error on release and rehire: ", e) + print("Error on release and rehire: ", e) return jsonify({"Success": False}) diff --git a/app/controllers/main_routes/main_routes.py b/app/controllers/main_routes/main_routes.py index a69c8f379..f93ade7a5 100755 --- a/app/controllers/main_routes/main_routes.py +++ b/app/controllers/main_routes/main_routes.py @@ -88,7 +88,7 @@ def addUserToDept(): return "True" except Exception as e: - (f'Could not add user to department: {e}') + print(f'Could not add user to department: {e}') return "", 500 @main_bp.route('/supervisorPortal/download', methods=['POST']) @@ -99,7 +99,7 @@ def downloadSupervisorPortalResults(): ''' formSearchResults = retrieveFormSearchResult(request.form.get('downloadId')) if not formSearchResults: - (f"[ERROR] Missing or invalid download ID for form search.") + print(f"[ERROR] Missing or invalid download ID for form search.") return "", 500 formSearchResultIds = json.loads(formSearchResults.formHistoryIds) @@ -122,7 +122,7 @@ def submitToBanner(formHistoryId): save_form_status = conn.insert(formHistoryId) except Exception as e: save_form_status = False - (f"Error saving form history ({formHistoryId}) to Banner.") + print(f"Error saving form history ({formHistoryId}) to Banner.") if save_form_status: return "Form successfully submitted to Banner.", 200 diff --git a/app/logic/allPendingForms.py b/app/logic/allPendingForms.py index 6d6c9cd5d..60110d5ef 100644 --- a/app/logic/allPendingForms.py +++ b/app/logic/allPendingForms.py @@ -73,11 +73,11 @@ def saveStatus(new_status, formHistoryIds, currentUser): overrideOriginalStatusFormOnAdjustmentFormApproval(formHistory, LSF) else: - ("Unable to update form status for formHistoryID {}.".format(id)) + print("Unable to update form status for formHistoryID {}.".format(id)) return jsonify({"success": False}), 500 except Exception as e: - ("Error preparing form for status update:", e) + print("Error preparing form for status update:", e) return jsonify({"success": False}), 500 return jsonify({"success": True}) @@ -160,7 +160,7 @@ def laborAdminOverloadApproval(rsp, historyForm, status, currentUser, currentDat except DoesNotExist: pass except Exception as e: - (e) + print(e) if 'denialReason' in rsp.keys(): # We only update the reject reason if one was given on the UI historyForm.rejectReason = rsp['denialReason'] diff --git a/app/logic/banner.py b/app/logic/banner.py index 6929b8e25..7c6daac03 100644 --- a/app/logic/banner.py +++ b/app/logic/banner.py @@ -16,10 +16,10 @@ def __init__(self): app.config["banner"]["user"], app.config["banner"]["password"], "{url}:{port}/{sid}".format(**app.config["banner"])) - ("BANNER connection initialized. Oracle version {}".format(self.conn.version)) + print("BANNER connection initialized. Oracle version {}".format(self.conn.version)) except Exception as err: - ("BANNER connection failed: {}: {}".format(type(err).__name__, err)) + print("BANNER connection failed: {}: {}".format(type(err).__name__, err)) self.database_exists = False raise err @@ -33,7 +33,7 @@ def query(self, sql): cursor.execute(sql) return cursor.fetchall() except Exception as err: - ("Error querying BANNER db:", err) + print("Error querying BANNER db:", err) return [] return [] @@ -87,10 +87,10 @@ def insert(self, formHistory): cursor = self.conn.cursor() result = cursor.execute(stmt, params) self.conn.commit() - ("Form {} inserted into banner".format(form.laborStatusFormID)) + print("Form {} inserted into banner".format(form.laborStatusFormID)) except Exception as err: - ("Error inserting into BANNER db:", err) + print("Error inserting into BANNER db:", err) return False return True # If we got here, we are successful (even if we didn't even try to insert) diff --git a/app/logic/emailHandler.py b/app/logic/emailHandler.py index 3678b34ca..5f7bf2595 100644 --- a/app/logic/emailHandler.py +++ b/app/logic/emailHandler.py @@ -88,9 +88,9 @@ def __init__(self, formHistoryKey): except Exception as e: # The error you should get when the form is not a release form # is the 'AttributeError' error. We expect to get the 'AttributeError', - # but if we get anything else then we want to the error + # but if we get anything else then we want to print the error if e.__class__.__name__ != "AttributeError": - (e) + print(e) def send(self, message: Message): if app.config['ENV'] == 'production' or app.config['ALWAYS_SEND_MAIL']: @@ -101,14 +101,14 @@ def send(self, message: Message): message.recipients = [app.config['MAIL_OVERRIDE_ALL']] message.reply_to = app.config["REPLY_TO_ADDRESS"] - # ("Debugging emailHandler.py: ", app.config) + print("Debugging emailHandler.py: ", app.config) self.mail.send(message) elif app.config['ENV'] == 'testing': # TODO: we really should have a way to check that we're sending emails that doesn't spam the logs pass else: - ("ENV: {}. Email not sent to {}, subject '{}'.".format(app.config['ENV'], message.recipients, message.subject)) + print("ENV: {}. Email not sent to {}, subject '{}'.".format(app.config['ENV'], message.recipients, message.subject)) diff --git a/app/logic/statusFormFunctions.py b/app/logic/statusFormFunctions.py index b38f9eae0..92f4b71f6 100644 --- a/app/logic/statusFormFunctions.py +++ b/app/logic/statusFormFunctions.py @@ -276,11 +276,11 @@ def createOverloadForm(newWeeklyHours, lsf, currentUser, adjustedForm=None, for overloadEmail.LaborOverLoadFormSubmitted(link) except Exception as e: - ("An error occured while attempting to send overload form emails: ", e) + print("An error occured while attempting to send overload form emails: ", e) # This will delete an overload form after the hours are changed elif previousTotalHours > 15 and newTotalHours <= 15: # If we were overloading and now we aren't - (f"Trying to get formhistory with formID '{lsf.laborStatusFormID}' and history type: 'Labor Overload Form'") + print(f"Trying to get formhistory with formID '{lsf.laborStatusFormID}' and history type: 'Labor Overload Form'") deleteOverloadForm = FormHistory.get((FormHistory.formID == lsf.laborStatusFormID) & (FormHistory.historyType == "Labor Overload Form")) deleteOverloadForm = OverloadForm.get(OverloadForm.overloadFormID == deleteOverloadForm.overloadForm_id) deleteOverloadForm.delete_instance() # This line also deletes the Form History since it's set to cascade up in the model file diff --git a/app/logic/userInsertFunctions.py b/app/logic/userInsertFunctions.py index 7a363cba7..bd6995412 100644 --- a/app/logic/userInsertFunctions.py +++ b/app/logic/userInsertFunctions.py @@ -69,7 +69,7 @@ def updateUserFromTracy(user): baseObj.save() except Exception as e: - ( f"We don't want to break our login if an old tracy user doesn't exist or something") + print( f"We don't want to break our login if an old tracy user doesn't exist or something") return user @@ -175,7 +175,7 @@ def createStudentFromTracy(username=None, bnumber=None): try: return Student.get(Student.ID == tracyStudent.ID.strip()) except DoesNotExist: - #('Could not find {0} {1} in Student table, creating new entry.'.format(tracyStudent.FIRST_NAME, tracyStudent.LAST_NAME)) + print('Could not find {0} {1} in Student table, creating new entry.'.format(tracyStudent.FIRST_NAME, tracyStudent.LAST_NAME)) return Student.create(ID = tracyStudent.ID.strip(), PIDM = tracyStudent.PIDM, legal_name = tracyStudent.FIRST_NAME, @@ -224,5 +224,5 @@ def createSupervisorFromTracy(username=None, bnumber=None): ORG = tracyUser.ORG, DEPT_NAME = tracyUser.DEPT_NAME) except Exception as e: - (e) + print(e) raise InvalidUserException("Error: Could not get or create {0} {1}".format(tracyUser.FIRST_NAME, tracyUser.LAST_NAME)) diff --git a/app/login_manager.py b/app/login_manager.py index 9f6e5374d..d0af932b8 100755 --- a/app/login_manager.py +++ b/app/login_manager.py @@ -20,7 +20,7 @@ def logout(): Erases the session and returns the URL for redirection """ if 'username' in session: - ("Logging out", session['username']) + print("Logging out", session['username']) session.clear() url ="/" @@ -34,7 +34,7 @@ def require_login(): try: user = auth_user(env, username) except InvalidUserException as e: - ("Invalid User:", e) + print("Invalid User:", e) return False # Update the user's name diff --git a/app/static/js/ckeditor/LICENSE.md b/app/static/js/ckeditor/LICENSE.md index 02fdd2d4b..1c71a8768 100644 --- a/app/static/js/ckeditor/LICENSE.md +++ b/app/static/js/ckeditor/LICENSE.md @@ -173,14 +173,14 @@ above, provided that you also meet all of these conditions: c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such - interactive use in the most ordinary way, to or display an + interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally such an announcement, your work based on - the Program is not required to an announcement.) + the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, diff --git a/database/active_position_reader.py b/database/active_position_reader.py index 8eaa16adf..c4e7be9ed 100644 --- a/database/active_position_reader.py +++ b/database/active_position_reader.py @@ -17,10 +17,10 @@ def get_all_departments(): except DoesNotExist as e: update_rows = Department.update(DEPT_NAME = dept.DEPT_NAME).where(Department.ACCOUNT == dept.ACCOUNT, Department.ORG == dept.ORG).execute() if update_rows: - (f" Updated department from Tracy: {dept.DEPT_NAME}, {dept.ACCOUNT}, {dept.ORG}") + print(f" Updated department from Tracy: {dept.DEPT_NAME}, {dept.ACCOUNT}, {dept.ORG}") else: Department.create(DEPT_NAME = dept.DEPT_NAME, ACCOUNT = dept.ACCOUNT, ORG = dept.ORG) - (f" Created new department from Tracy: {dept.DEPT_NAME}, {dept.ACCOUNT}, {dept.ORG}") + print(f" Created new department from Tracy: {dept.DEPT_NAME}, {dept.ACCOUNT}, {dept.ORG}") def convert_dept_org_act_to_id(row_data): @@ -45,7 +45,7 @@ def supervisor_to_user(bnumber): try: return User.get(supervisor_id=bnumber) except: - (" Uhoh, no user for this supervisor. This will cause an error in creation.", bnumber) + print(" Uhoh, no user for this supervisor. This will cause an error in creation.", bnumber) def update_record(form, row): start_date, end_date, term_code = convert_dates_to_term_code(labor_data.loc[row, "Begin Date"], labor_data.loc[row, "End Date"]) @@ -96,7 +96,7 @@ def create_record(row): return lsf def print_banner_row(row): - (labor_data.loc[row,:]) + print(labor_data.loc[row,:]) @@ -109,7 +109,7 @@ def print_banner_row(row): primary_indexes = {} # store the primary position indexes for each B# supervisor_cache = {} -("Updating departments...") +print("Updating departments...") get_all_departments() # initial pass, ensuring supervisors and students are in our database and collating student records @@ -128,7 +128,7 @@ def print_banner_row(row): # try to get from Tracy if we need to getOrCreateStudentRecord(bnumber = labor_data.loc[row, "B#"]) except: - (f"Creating student record from scratch ({labor_data.loc[row, 'B#']})") + print(f"Creating student record from scratch ({labor_data.loc[row, 'B#']})") Student.create(ID = labor_data.loc[row, "B#"], PIDM = None, FIRST_NAME = labor_data.loc[row, "First Name"], @@ -151,7 +151,7 @@ def print_banner_row(row): primary_indexes.setdefault(labor_data.loc[row, 'B#'], []).append(row) else: # unknown value - (f"Unknown Contract Type!! {labor_data.loc[row, 'Contract Type']}") + print(f"Unknown Contract Type!! {labor_data.loc[row, 'Contract Type']}") quit() # End csv loop @@ -164,12 +164,12 @@ def print_banner_row(row): ########################################################################################### ### Primaries ### ########################################################################################### -() -("Processing Primary Records") -("--------------------------") +print() +print("Processing Primary Records") +print("--------------------------") for student_id, banner_forms in primary_indexes.items(): - () - (f"Processing {student_id}") + print() + print(f"Processing {student_id}") lsf_forms = (LaborStatusForm.select().where( (LaborStatusForm.studentSupervisee_id == student_id) & @@ -181,7 +181,7 @@ def print_banner_row(row): # sanity check if banner_count > 1: - (" I didn't think there were multiple banner primaries.", labor_data.loc[row, "B#"]) + print(" I didn't think there were multiple banner primaries.", labor_data.loc[row, "B#"]) quit() row = banner_forms[0] # only one record to deal with for primaries @@ -190,18 +190,18 @@ def print_banner_row(row): if banner_count and not lsf_count: lsf = create_record(row) created_primaries += 1 - (f" Created Primary labor status form {lsf.laborStatusFormID} for {labor_data.loc[row, 'B#']}") + print(f" Created Primary labor status form {lsf.laborStatusFormID} for {labor_data.loc[row, 'B#']}") # update else: if lsf_count > 1: - (" This student had multiple primaries. Check to make sure the proper one was updated.") + print(" This student had multiple primaries. Check to make sure the proper one was updated.") # only update the most recent one, to handle one in banner and 2 in lsf most_recent_form = lsf_forms.get() update_record(most_recent_form, row) - (f" Updated Primary labor status form {most_recent_form.laborStatusFormID} for {labor_data.loc[row, 'B#']}.") + print(f" Updated Primary labor status form {most_recent_form.laborStatusFormID} for {labor_data.loc[row, 'B#']}.") updated_primaries += 1 @@ -231,9 +231,9 @@ def print_banner_row(row): ########################################################################################### ### Secondaries ### ########################################################################################### -() -("Processing Secondary Records") -("--------------------------") +print() +print("Processing Secondary Records") +print("--------------------------") for student_id, banner_forms in secondary_indexes.items(): () (f"Processing {student_id}") @@ -252,7 +252,7 @@ def print_banner_row(row): if lsf_count == 1 and banner_count == 1: update_record(lsf_forms.get(), banner_forms[0]) updated_secondaries += 1 - (" Updating Secondary Form") + print(" Updating Secondary Form") # we need to match up the secondaries to update the correct ones elif lsf_count == banner_count: @@ -267,8 +267,8 @@ def print_banner_row(row): update_record(list(lsf_forms)[1], banner_forms[0]) else: - (" XXX Even counts in LSF and Banner. Need to match them up manually, to be safe.") - (list(lsf_forms)) + print(" XXX Even counts in LSF and Banner. Need to match them up manually, to be safe.") + print(list(lsf_forms)) for row in banner_forms: print_banner_row(row) @@ -278,7 +278,7 @@ def print_banner_row(row): for row in banner_forms: lsf = create_record(row) created_secondaries += 1 - (f" Created new Secondary form {lsf.laborStatusFormID}") + print(f" Created new Secondary form {lsf.laborStatusFormID}") #an extra secondary in banner to create elif banner_count > lsf_count: @@ -289,8 +289,8 @@ def print_banner_row(row): create_record(banner_forms[1]) else: - (" XXX Extra Secondaries in Banner for Unknown Student. Resolve them manually, to be safe.") - (lsf_forms) + print(" XXX Extra Secondaries in Banner for Unknown Student. Resolve them manually, to be safe.") + print(lsf_forms) for row in banner_forms: print_banner_row(row) @@ -298,23 +298,23 @@ def print_banner_row(row): #extra secondaries in lsf else: # we can't just update the most recent. Doesn't work for B00773583, B00762761, at least - (f" XXX Extra Secondaries in LSF. Saving resolution for later") + print(f" XXX Extra Secondaries in LSF. Saving resolution for later") manual_records[student_id] = banner_forms -() -("Number of New Primaries:", created_primaries) -("Number of Updated Primaries:", updated_primaries) -("Number of New Secondaries:", created_secondaries) -("Number of Updated Secondaries:", updated_secondaries) -("Number of Updated Second Secondaries:", updated_second_secondaries) +print() +print("Number of New Primaries:", created_primaries) +print("Number of Updated Primaries:", updated_primaries) +print("Number of New Secondaries:", created_secondaries) +print("Number of Updated Secondaries:", updated_secondaries) +print("Number of Updated Second Secondaries:", updated_second_secondaries) for student_id, banner_forms in manual_records.items(): - () - ("-------------------------------------------------------------------") - (student_id) - ("-------------------------------------------------------------------") + print() + print("-------------------------------------------------------------------") + print(student_id) + print("-------------------------------------------------------------------") for row in banner_forms: print_banner_row(row) - ("-------------------------------------------------------------------") + print("-------------------------------------------------------------------") diff --git a/database/add_admins.py b/database/add_admins.py index b475b9cb7..deac83da8 100644 --- a/database/add_admins.py +++ b/database/add_admins.py @@ -4,7 +4,7 @@ students = ['manalaih','mupotsal','escalerapadronl','cruzg','romanow','crafta','rieral','juem','jamalie', 'makindeo'] staff = ['bryantal','ramsayb2','heggens','knowlesg', 'welshs', 'napoleonr2', 'buenrostroa', 'ashb', 'gosneyj', 'asantes'] -("Adding staff admins") +print("Adding staff admins") for s in staff: obj = createSupervisorFromTracy(s) createUser(s, supervisor=obj) @@ -12,7 +12,7 @@ u.isLaborAdmin = True u.save() -("Adding student admins") +print("Adding student admins") for s in students: obj = createStudentFromTracy(s) createUser(s, student=obj) diff --git a/database/demo_data.py b/database/demo_data.py index 51d5eedde..c39da4771 100644 --- a/database/demo_data.py +++ b/database/demo_data.py @@ -16,7 +16,7 @@ from app.models.formHistory import FormHistory from app.models.notes import Notes -("Inserting data for demo and testing purposes") +print("Inserting data for demo and testing purposes") ############################# # Students (TRACY) @@ -165,7 +165,7 @@ students.append(student) Student.insert_many(students).on_conflict_replace().execute() -(" * students (TRACY) added") +print(" * students (TRACY) added") ############################# # Positions (TRACY) @@ -364,7 +364,7 @@ db.session.add(STUSTAFF(**staff)) db.session.commit() -(" * staff added") +print(" * staff added") ############################# @@ -445,7 +445,7 @@ } ] User.insert_many(users).on_conflict_replace().execute() -(" * users added") +print(" * users added") @@ -492,7 +492,7 @@ ] Department.insert_many(departments).on_conflict_replace().execute() -(" * departments added") +print(" * departments added") ############################# # Term @@ -523,7 +523,7 @@ ] Term.insert_many(terms).on_conflict_replace().execute() -(" * terms added") +print(" * terms added") ############################# # Create a Pending Labor Status Form @@ -603,4 +603,4 @@ }, ] Notes.insert_many(notes).on_conflict_replace().execute() -(" * laborOfficeNotes added") +print(" * laborOfficeNotes added") diff --git a/database/dump-and-scrub.sh b/database/dump-and-scrub.sh index 6f5b5a2ae..c3e18c1b7 100755 --- a/database/dump-and-scrub.sh +++ b/database/dump-and-scrub.sh @@ -29,7 +29,7 @@ echo -e "done.\n" # Execute SQL in data-scrub.sql # watch out for those escaped quotes if you have to change something awk " - /--/ {} + /--/ {print} /^[^-]/ { printf \"EXECUTING: %s\n\n\",\$0 system(\"mysql $CONN $TMPDB -e \\\" \" \$0 \" \\\" \") diff --git a/database/fix-fall-positions/fix_terms.py b/database/fix-fall-positions/fix_terms.py index 77cb11951..10c0e6784 100644 --- a/database/fix-fall-positions/fix_terms.py +++ b/database/fix-fall-positions/fix_terms.py @@ -7,11 +7,10 @@ ay_term = Term.get(termCode=202000) with open('activepositions.csv','r',encoding="cp1252",newline='') as f: - (" * Getting records...") + print(" * Getting records...") reader = csv.DictReader(f, delimiter=',', restkey='extra', restval='XXXX') reader.__next__() # skip headers for row in reader: - #(row) bnumber = row['ID'] position = row['Position'] @@ -21,10 +20,10 @@ LaborStatusForm.POSN_CODE==position) if not forms: - (f"No form found in Fall for {bnumber}, {position}") + print(f"No form found in Fall for {bnumber}, {position}") break for lsf in forms: - (f"Updating {position} form for {bnumber}") + print(f"Updating {position} form for {bnumber}") lsf.termCode = ay_term.termCode lsf.save() diff --git a/database/import-old-data/copy_old_data.py b/database/import-old-data/copy_old_data.py index 18029f768..e9281eadc 100644 --- a/database/import-old-data/copy_old_data.py +++ b/database/import-old-data/copy_old_data.py @@ -14,7 +14,7 @@ # :%s/ctrl-v ctrl-r/,/g # :%s/&/\&/g -("Creating terms...") +print("Creating terms...") createTerms(2015) createTerms(2016) createTerms(2017) @@ -70,10 +70,9 @@ def import_file(filepath, fields): with open(filepath,'r',encoding="cp1252",newline='') as reader: - ("Importing {}...".format(filepath)) - (" * Validating...") + print("Importing {}...".format(filepath)) + print(" * Validating...") if importf.validate_file(reader, fields): - (" * Getting records...") data = importf.getList(reader, fields) saved = 0 terms = {} @@ -81,11 +80,11 @@ def import_file(filepath, fields): for record in data: if importf.importRecord(record, terms): saved += 1 - (".", end="", flush=True) + print(".", end="", flush=True) if saved % 100 == 0: (str(saved).rjust(8)) else: - ("X", end="", flush=True) + print("X", end="", flush=True) ("\nCreated {} forms\n".format(saved)) pp = pprint.PrettyPrinter(indent=4) diff --git a/database/import-old-data/import_functions.py b/database/import-old-data/import_functions.py index ffaa02b35..8d1f6fd1b 100644 --- a/database/import-old-data/import_functions.py +++ b/database/import-old-data/import_functions.py @@ -12,7 +12,7 @@ def debug(msg): if DEBUG: - (msg) + print(msg) def getReader(f, fields): @@ -32,16 +32,16 @@ def validate_file(f, fields): # Check for places where we didn't escape text for row in reader: if 'extra' in row and row['extra'] is not None: - ("Line {}:".format(reader.line_num), "Extra comma in line. Need quotes") + print("Line {}:".format(reader.line_num), "Extra comma in line. Need quotes") success = False try: int(row['form_id']) if row['note'] == 'XXXX': # XXX breaks on the last line - ("Line {}:".format(reader.line_num), "Not enough columns") + print("Line {}:".format(reader.line_num), "Not enough columns") success = False except: - ("Line {}:".format(reader.line_num), "Bad ID '{}'. Need quotes on previous line.".format(row['form_id'])) + print("Line {}:".format(reader.line_num), "Bad ID '{}'. Need quotes on previous line.".format(row['form_id'])) success = False f.seek(0) @@ -190,7 +190,7 @@ def importRecord(record, terms): position = Tracy().getPositionFromCode(record['posn_code']) except InvalidQueryException: if 'department' not in record: - ("There is no position code {} in Tracy and we need it for department".format(record['posn_code'])) + print("There is no position code {} in Tracy and we need it for department".format(record['posn_code'])) return False @@ -227,7 +227,7 @@ def importRecord(record, terms): try: term = getTerm(record['term'], record['start'].split('-')[0], terms) except DoesNotExist: - ("XXX Can't find a matching term for '{}'".format(record['term'])) + print("XXX Can't find a matching term for '{}'".format(record['term'])) return False # estimate the proper hours and length of the contract diff --git a/database/manual-secondary-fixer.py b/database/manual-secondary-fixer.py index 1d4decde1..cc2381d53 100644 --- a/database/manual-secondary-fixer.py +++ b/database/manual-secondary-fixer.py @@ -46,7 +46,7 @@ def update_record(form, row): form.save() def print_banner_row(row): - (labor_data.loc[row,:]) + print(labor_data.loc[row,:]) @@ -99,15 +99,15 @@ def print_banner_row(row): 1543: 34188 } -() -("Processing Secondary Records") -("--------------------------") +print() +print("Processing Secondary Records") +print("--------------------------") for row, lsf_id in rows_to_process.items(): - () + print() form = LaborStatusForm.get_by_id(lsf_id); - (f"Processing {form.studentSupervisee_id}") + print(f"Processing {form.studentSupervisee_id}") if form.studentSupervisee_id != labor_data.loc[row,'B#']: - ("Mismatched Record!", form.studentSupervisee_id, labor_data.loc[row,'B#']) + print("Mismatched Record!", form.studentSupervisee_id, labor_data.loc[row,'B#']) quit() update_record(form, row) diff --git a/db_test.py b/db_test.py index a9a494b3a..81bb1f056 100644 --- a/db_test.py +++ b/db_test.py @@ -51,7 +51,7 @@ app.config['SQLALCHEMY_DATABASE_URI'] = uri db = SQLAlchemy(app) -("FLASK:",Tracy().getPositionFromCode("S01015")) +print("FLASK:",Tracy().getPositionFromCode("S01015")) ########################### # Test Banner connection diff --git a/scripts/updateDBRecords.py b/scripts/updateDBRecords.py index 6a32fdfc3..ef6cab824 100644 --- a/scripts/updateDBRecords.py +++ b/scripts/updateDBRecords.py @@ -2,17 +2,17 @@ studentsFound, studentsNotFound, studentsFailed, supervisorsFound, supervisorsNotFound, supervisorsFailed = updatePersonRecords() -("Students updated: " + str(studentsFound)) -("Students not found: " + str(studentsNotFound)) -("Students failed: " + str(studentsFailed)) -("Supervisors updated: " + str(supervisorsFound)) -("Supervisors not found: " + str(supervisorsNotFound)) -("Supervisors failed: " + str(supervisorsFailed)) -("Total Person updates: " + str(studentsFound + supervisorsFound)) -("Total Person fails: " + str(studentsFailed + supervisorsFailed)) +print("Students updated: " + str(studentsFound)) +print("Students not found: " + str(studentsNotFound)) +print("Students failed: " + str(studentsFailed)) +print("Supervisors updated: " + str(supervisorsFound)) +print("Supervisors not found: " + str(supervisorsNotFound)) +print("Supervisors failed: " + str(supervisorsFailed)) +print("Total Person updates: " + str(studentsFound + supervisorsFound)) +print("Total Person fails: " + str(studentsFailed + supervisorsFailed)) departmentsPulledFromTracy, departmentsUpdated, departmentsNotFound, departmentsFailed = updatePositionRecords() -("New Departments pulled: " + str(departmentsPulledFromTracy)) -("Departments updated: " + str(departmentsUpdated)) -("Departments not found: " + str(departmentsNotFound)) -("Departments failed: " + str(departmentsFailed)) +print("New Departments pulled: " + str(departmentsPulledFromTracy)) +print("Departments updated: " + str(departmentsUpdated)) +print("Departments not found: " + str(departmentsNotFound)) +print("Departments failed: " + str(departmentsFailed)) diff --git a/setup.sh b/setup.sh index 08fccb6a4..3bcaf9dac 100755 --- a/setup.sh +++ b/setup.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Check for correct python version -VERSION=`python3 --version | awk '{ $2}'` +VERSION=`python3 --version | awk '{print $2}'` if [ "${VERSION:0:1}" -ne "3" ] || [ "${VERSION:2:2}" -lt "10" ] || [ "${VERSION:2:2}" -gt "12" ]; then echo "You must use Python > 3.10. You are using $VERSION" echo "When upgrading, remember to install python3.X-dev and python3.X-venv" diff --git a/tests/mail_test.py b/tests/mail_test.py index 640e6209c..f590e5628 100644 --- a/tests/mail_test.py +++ b/tests/mail_test.py @@ -5,7 +5,5 @@ with app.app_context(): msg = Message("Test Email", recipients=["laborstatusform-aaaaazdxy4j2lsinl67ikumy4y@studentprogrammers.slack.com"],html="

Test

Whooo",sender="support@bereacollege.onmicrosoft.com") mail = Mail(app) - - ("Sending") mail.send(msg) - ("Sent") + diff --git a/tests/ui/functional_test.py b/tests/ui/functional_test.py index c7d9cc435..8d7316f61 100644 --- a/tests/ui/functional_test.py +++ b/tests/ui/functional_test.py @@ -30,10 +30,10 @@ def test_get_routes(self, base_url): pass urls = self.get_urls("GET") for browser in self.drivers: - ("\nTesting {}".format(browser.name)) + print("\nTesting {}".format(browser.name)) for url in urls: - (" {}:".format(url), end=" ") + print(" {}:".format(url), end=" ") browser.get(base_url + url) #assert 200 == urllib.request.urlopen('{}/{}'.format(base_url, url)).getcode() (colorama.Fore.GREEN + "✓" + colorama.Style.RESET_ALL) diff --git a/tests/ui/smoke_test.py b/tests/ui/smoke_test.py index 9ea406070..f32b24216 100644 --- a/tests/ui/smoke_test.py +++ b/tests/ui/smoke_test.py @@ -90,11 +90,11 @@ def url_runner(self, base_url, urls): """Test a list of URLs""" if(self.verbose): - () + print() for url,params in urls: sleep(.05) # Without this sleep we end up with Remote Disconnect exceptions if(self.verbose): - (" {}:".format(url), end=" ") + print(" {}:".format(url), end=" ") try: req = urllib.request.Request('{}{}'.format(base_url, url)) From c63003bf22bbdbe178ec720a4dc19bfa51daa090 Mon Sep 17 00:00:00 2001 From: glek <156453486+Kafui123@users.noreply.github.com> Date: Thu, 13 Nov 2025 01:42:39 +0000 Subject: [PATCH 15/32] added some print statements to get rid of errors --- database/active_position_reader.py | 12 ++++-------- database/demo_data.py | 6 +++--- database/import-old-data/copy_old_data.py | 6 ++---- scripts/sync_preferred_name.py | 3 +-- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/database/active_position_reader.py b/database/active_position_reader.py index c4e7be9ed..f18199bf2 100644 --- a/database/active_position_reader.py +++ b/database/active_position_reader.py @@ -109,11 +109,10 @@ def print_banner_row(row): primary_indexes = {} # store the primary position indexes for each B# supervisor_cache = {} -print("Updating departments...") + get_all_departments() -# initial pass, ensuring supervisors and students are in our database and collating student records -("Initial pass through the data...") + for row in range(len(labor_data)): # clean some data. try not to repeat queries @@ -231,12 +230,9 @@ def print_banner_row(row): ########################################################################################### ### Secondaries ### ########################################################################################### -print() -print("Processing Secondary Records") -print("--------------------------") + for student_id, banner_forms in secondary_indexes.items(): - () - (f"Processing {student_id}") + lsf_forms = (LaborStatusForm.select().where( (LaborStatusForm.studentSupervisee_id == student_id) & diff --git a/database/demo_data.py b/database/demo_data.py index c39da4771..ca3d520f1 100644 --- a/database/demo_data.py +++ b/database/demo_data.py @@ -63,7 +63,7 @@ "MAJOR":"Computer Science", "PROBATION":"0", "ADVISOR":"Jan Pearce", - "STU_EMAIL":"u0125324935@gmail.com", + "STU_EMAIL":"cruzg@berea.edu", "STU_CPO":"300", "LAST_POSN":"TA", "LAST_SUP_PIDM":"7" @@ -258,7 +258,7 @@ db.session.add(STUPOSN(**position)) db.session.commit() -(" * positions (TRACY) added") +print(" * positions (TRACY) added") ############################# # TRACY Staff @@ -523,7 +523,7 @@ ] Term.insert_many(terms).on_conflict_replace().execute() -print(" * terms added") + ############################# # Create a Pending Labor Status Form diff --git a/database/import-old-data/copy_old_data.py b/database/import-old-data/copy_old_data.py index e9281eadc..79257896a 100644 --- a/database/import-old-data/copy_old_data.py +++ b/database/import-old-data/copy_old_data.py @@ -70,8 +70,6 @@ def import_file(filepath, fields): with open(filepath,'r',encoding="cp1252",newline='') as reader: - print("Importing {}...".format(filepath)) - print(" * Validating...") if importf.validate_file(reader, fields): data = importf.getList(reader, fields) saved = 0 @@ -82,11 +80,11 @@ def import_file(filepath, fields): saved += 1 print(".", end="", flush=True) if saved % 100 == 0: - (str(saved).rjust(8)) + print(str(saved).rjust(8)) else: print("X", end="", flush=True) - ("\nCreated {} forms\n".format(saved)) + print("\nCreated {} forms\n".format(saved)) pp = pprint.PrettyPrinter(indent=4) pp.pprint(terms) diff --git a/scripts/sync_preferred_name.py b/scripts/sync_preferred_name.py index e7fe073aa..bf0fb879d 100644 --- a/scripts/sync_preferred_name.py +++ b/scripts/sync_preferred_name.py @@ -9,7 +9,6 @@ def connect_to_server(user,password): server = Server ('berea.edu', port=389, use_ssl=False, get_info='ALL') conn = Connection (server, user=user, password=password) if not conn.bind(): - (conn.result) raise Exception("BindError") return conn @@ -29,7 +28,7 @@ def update_records(table, people): count = table.update(preferred_name=preferred).where(table.ID == bnumber).execute() if count: - ("Updating",bnumber,"name to",preferred) + print("Updating",bnumber,"name to",preferred) def alphaRange(start,end): return [chr(i) for i in range(ord(start), ord(end)+1)] From 862536ca573bac5507fa80cd7f9d13531c91c746 Mon Sep 17 00:00:00 2001 From: glek <156453486+Kafui123@users.noreply.github.com> Date: Thu, 13 Nov 2025 21:16:57 +0000 Subject: [PATCH 16/32] Resolved the requested changes --- .vscode/settings.json | 4 ---- app/controllers/main_routes/laborStatusForm.py | 2 +- .../main_routes/studentOverloadApp.py | 18 +++++++++--------- app/logic/emailHandler.py | 1 - scripts/sync_preferred_name.py | 2 +- 5 files changed, 11 insertions(+), 16 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index e0f4385ba..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "python-envs.pythonProjects": [], - "python-envs.defaultEnvManager": "ms-python.python:system" -} \ No newline at end of file diff --git a/app/controllers/main_routes/laborStatusForm.py b/app/controllers/main_routes/laborStatusForm.py index d1f97ff31..dc794952d 100755 --- a/app/controllers/main_routes/laborStatusForm.py +++ b/app/controllers/main_routes/laborStatusForm.py @@ -90,7 +90,7 @@ def userInsert(): try: emailDuringBreak(checkForSecondLSFBreak(term.termCode, student.ID), term) except Exception as e: - ("Error when sending emails during break: " + str(e)) + print("Error when sending emails during break: " + str(e)) all_forms.append(True) except Exception as e: diff --git a/app/controllers/main_routes/studentOverloadApp.py b/app/controllers/main_routes/studentOverloadApp.py index 5fcb58974..8ec603a35 100755 --- a/app/controllers/main_routes/studentOverloadApp.py +++ b/app/controllers/main_routes/studentOverloadApp.py @@ -85,17 +85,17 @@ def studentOverloadApp(formHistoryId): totalCurrentHours += j.formID.weeklyHours totalFormHours = totalCurrentHours + prefillHoursOverload - adjusted_change = AdjustmentForm.adjustedForm + adjustedChange = AdjustmentForm.adjustedForm - field_name = adjusted_change.fieldAdjusted - old_value = adjusted_change.oldValue - new_value = adjusted_change.newValue + fieldName = adjustedChange.fieldAdjusted + oldValue = adjustedChange.oldValue + newValue = adjustedChange.newValue - if field_name == "department": - old_dept = Department.get(Department.ORG == old_value) - new_dept = Department.get(Department.ORG == new_value) - old_value = old_dept.DEPT_NAME - new_value = new_dept.DEPT_NAME + if fieldName == "department": + oldDept = Department.get(Department.ORG == oldValue) + newDept = Department.get(Department.ORG == newValue) + oldValue = oldDept.DEPT_NAME + newValue = newDept.DEPT_NAME return render_template( 'main/studentOverloadApp.html', diff --git a/app/logic/emailHandler.py b/app/logic/emailHandler.py index 5f7bf2595..de33d7044 100644 --- a/app/logic/emailHandler.py +++ b/app/logic/emailHandler.py @@ -101,7 +101,6 @@ def send(self, message: Message): message.recipients = [app.config['MAIL_OVERRIDE_ALL']] message.reply_to = app.config["REPLY_TO_ADDRESS"] - print("Debugging emailHandler.py: ", app.config) self.mail.send(message) elif app.config['ENV'] == 'testing': diff --git a/scripts/sync_preferred_name.py b/scripts/sync_preferred_name.py index bf0fb879d..fdb2d90d0 100644 --- a/scripts/sync_preferred_name.py +++ b/scripts/sync_preferred_name.py @@ -42,7 +42,7 @@ def fetch_descriptions(conn, descriptions): conn.search('dc=berea,dc=edu', f"(&{letterQuery}{descriptionQuery})", attributes = ['samaccountname', 'givenname', 'sn', 'employeeid'] ) - (f"Found {len(conn.entries)} {descriptions} {letters[0]}-{letters[-1]} in AD"); + print(f"Found {len(conn.entries)} {descriptions} {letters[0]}-{letters[-1]} in AD") people += conn.entries return people From e3c10be10729c2b129b2b5bcd9a73837b08c74b6 Mon Sep 17 00:00:00 2001 From: glek <156453486+Kafui123@users.noreply.github.com> Date: Fri, 14 Nov 2025 21:16:12 +0000 Subject: [PATCH 17/32] Fixed pr comments --- .../main_routes/studentOverloadApp.py | 6 ++-- app/templates/main/studentOverloadApp.html | 36 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/controllers/main_routes/studentOverloadApp.py b/app/controllers/main_routes/studentOverloadApp.py index 8ec603a35..24410030a 100755 --- a/app/controllers/main_routes/studentOverloadApp.py +++ b/app/controllers/main_routes/studentOverloadApp.py @@ -102,9 +102,9 @@ def studentOverloadApp(formHistoryId): title=('student Overload Application'), username = currentUser, overloadForm = overloadForm, - field_name = field_name, - old_value = old_value, - new_value = new_value, + fieldName = fieldName, + oldValue = oldValue, + newValue = newValue, prefillStudentName = prefillStudentName, prefillStudentBnum = prefillStudentBnum, prefillStudentCPO = prefillStudentCPO, diff --git a/app/templates/main/studentOverloadApp.html b/app/templates/main/studentOverloadApp.html index acfdb98bd..2c1afc092 100755 --- a/app/templates/main/studentOverloadApp.html +++ b/app/templates/main/studentOverloadApp.html @@ -123,25 +123,25 @@

Requested Positions

{{primary.formID.termCode.termName}} - {% if field_name == "department" %} - {{ old_value }}
- {{ new_value }} + {% if fieldName == "department" %} + {{ oldValue }}
+ {{ newValue }} {% else %} {{primary.formID.department.DEPT_NAME}} {% endif %} {{primary.formID.jobType}} - {% if field_name == "POSN_TITLE" %} - {{ old_value }}
- {{ new_value }} + {% if fieldName == "POSN_TITLE" %} + {{ oldValue }}
+ {{ newValue }} {% else %} {{primary.formID.POSN_TITLE}} {% endif %} - {% if field_name == "weeklyHours" %} - {{ old_value }} {{ new_value }} + {% if fieldName == "weeklyHours" %} + {{ oldValue }} {{ newValue }} {% else %} {{primary.formID.weeklyHours}} {% endif %} @@ -155,25 +155,25 @@

Requested Positions

{{secondary.formID.termCode.termName}} - {% if field_name == "department" %} - {{ old_value }}
- {{ new_value }} + {% if fieldName == "department" %} + {{ oldValue }}
+ {{ newValue }} {% else %} {{secondary.formID.department.DEPT_NAME}} {% endif %} {{secondary.formID.jobType}} - {% if field_name == "POSN_TITLE" %} - {{ old_value }}
-
{{ new_value }} + {% if fieldName == "POSN_TITLE" %} + {{ oldValue }}
+
{{ newValue }} {% else %} {{secondary.formID.POSN_TITLE}} {% endif %} - {% if field_name == "weeklyHours" %} - {{ old_value }} {{ new_value }} + {% if fieldName == "weeklyHours" %} + {{ oldValue }} {{ newValue }} {% else %} {{secondary.formID.weeklyHours}} {% endif %} @@ -185,8 +185,8 @@

Requested Positions

Total Approved Primary and Secondary Hours: - {% if field_name == "weeklyHours" %} - {{ old_value }} {{ new_value }} + {% if fieldName == "weeklyHours" %} + {{ oldValue }} {{ newValue }} {% else %} {{totalCurrentHours}} {% endif %} From 553a3036ec0a8d598a1754c752b8c953f9041c58 Mon Sep 17 00:00:00 2001 From: glek <156453486+Kafui123@users.noreply.github.com> Date: Thu, 20 Nov 2025 22:27:08 +0000 Subject: [PATCH 18/32] Addressed some bugs here --- .../main_routes/studentOverloadApp.py | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/app/controllers/main_routes/studentOverloadApp.py b/app/controllers/main_routes/studentOverloadApp.py index 24410030a..c2591d1f0 100755 --- a/app/controllers/main_routes/studentOverloadApp.py +++ b/app/controllers/main_routes/studentOverloadApp.py @@ -18,7 +18,6 @@ def studentOverloadApp(formHistoryId): currentUser = require_login() overloadForm = FormHistory.get_by_id(formHistoryId) - AdjustmentForm = FormHistory.get_by_id(formHistoryId) if not currentUser.isLaborAdmin: if not currentUser: # Not logged in return render_template('errors/403.html'), 403 @@ -85,17 +84,22 @@ def studentOverloadApp(formHistoryId): totalCurrentHours += j.formID.weeklyHours totalFormHours = totalCurrentHours + prefillHoursOverload - adjustedChange = AdjustmentForm.adjustedForm + fieldName = None + oldValue = None + newValue = None + # this condition is here so that we do not error out on a new overload form. however, if we are coming from an adjustment, we want to show the changes. + if overloadForm.adjustedForm is not None: + adjustedChange = overloadForm.adjustedForm - fieldName = adjustedChange.fieldAdjusted - oldValue = adjustedChange.oldValue - newValue = adjustedChange.newValue + fieldName = adjustedChange.fieldAdjusted + oldValue = adjustedChange.oldValue + newValue = adjustedChange.newValue - if fieldName == "department": - oldDept = Department.get(Department.ORG == oldValue) - newDept = Department.get(Department.ORG == newValue) - oldValue = oldDept.DEPT_NAME - newValue = newDept.DEPT_NAME + if fieldName == "department": + oldDept = Department.get(Department.ORG == oldValue) + newDept = Department.get(Department.ORG == newValue) + oldValue = oldDept.DEPT_NAME + newValue = newDept.DEPT_NAME return render_template( 'main/studentOverloadApp.html', @@ -193,14 +197,14 @@ def updateDatabase(overloadFormHistoryID): overloadForm = overloadFormHistory.overloadForm - + # this line is here for an adjustment form that does not create an overload form yet. We do this so we can tie both of them together. if overloadForm is None: overloadForm = OverloadForm.create(studentOverloadReason=overloadReason) overloadForm.studentOverloadReason = overloadReason overloadFormHistory.overloadForm = overloadForm overloadFormHistory.save() - else: + else: overloadForm.studentOverloadReason = overloadReason overloadForm.save() From 43a9c17024dc53024de77c3bcef3fbdd19eb3abb Mon Sep 17 00:00:00 2001 From: glek <156453486+Kafui123@users.noreply.github.com> Date: Sat, 22 Nov 2025 23:43:20 +0000 Subject: [PATCH 19/32] Brought back print statements --- app.py | 4 ++-- app/controllers/main_routes/studentOverloadApp.py | 4 ++-- app/login_manager.py | 5 ++++- .../toolbarconfigurator/lib/codemirror/codemirror.css | 2 +- app/templates/snips/studentHistoryModal.html | 2 +- database/active_position_reader.py | 10 ++++++++-- database/base_data.py | 1 + database/demo_data.py | 2 +- database/fix-fall-positions/fix_terms.py | 1 + database/import-old-data/copy_old_data.py | 5 ++++- db_test.py | 3 +++ scripts/sync_preferred_name.py | 1 + tests/code/test_models.py | 2 +- tests/mail_test.py | 2 ++ tests/ui/functional_test.py | 2 +- tests/ui/smoke_test.py | 2 +- 16 files changed, 34 insertions(+), 14 deletions(-) diff --git a/app.py b/app.py index 3cd3d81b1..d7a8e73ca 100755 --- a/app.py +++ b/app.py @@ -21,8 +21,8 @@ PORT = 8080 if __name__ == "__main__": - # statements go to your log file in production; to your console while developing - + # Print statements go to your log file in production; to your console while developing + print ("Running server at http://{0}:{1}/".format(IP, PORT)) app.run(host = IP, port = PORT, debug = True, threaded = True) # The next logical place to look is the app/__init__.py file... diff --git a/app/controllers/main_routes/studentOverloadApp.py b/app/controllers/main_routes/studentOverloadApp.py index c2591d1f0..a9fc34600 100755 --- a/app/controllers/main_routes/studentOverloadApp.py +++ b/app/controllers/main_routes/studentOverloadApp.py @@ -128,7 +128,7 @@ def studentOverloadApp(formHistoryId): def withdrawRequest(formHistoryId): formHistory = FormHistory.get_by_id(formHistoryId) if formHistory.historyType_id != "Labor Overload Form": - ("Somehow we reached a non-overload form history entry ({formHistoryId}) from studentOverloadApp.") + print("Somehow we reached a non-overload form history entry ({formHistoryId}) from studentOverloadApp.") abort(500) # send a withdrawal notification to student and supervisor @@ -197,7 +197,7 @@ def updateDatabase(overloadFormHistoryID): overloadForm = overloadFormHistory.overloadForm - # this line is here for an adjustment form that does not create an overload form yet. We do this so we can tie both of them together. + # this line here for an adjustment form that has not created an overload form yet so we tie both of them together if overloadForm is None: overloadForm = OverloadForm.create(studentOverloadReason=overloadReason) overloadForm.studentOverloadReason = overloadReason diff --git a/app/login_manager.py b/app/login_manager.py index d0af932b8..49f67016d 100755 --- a/app/login_manager.py +++ b/app/login_manager.py @@ -41,7 +41,7 @@ def require_login(): user = updateUserFromTracy(user) if 'username' not in session: - ("Logging in as", user.username) + print("Logging in as", user.username) session['username'] = user.username return user @@ -63,10 +63,13 @@ def auth_user(env, username): description = env['description'].lower() supervisor = student = None if description == 'student': + print("Adding {} to student table".format(username)) student = createStudentFromTracy(username) else: + print("Adding {} to supervisor table".format(username)) supervisor = createSupervisorFromTracy(username) + print("Creating record for {} in user table".format(username)) return createUser(username, student=student, supervisor=supervisor) def getOpenTerm(): diff --git a/app/static/js/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css b/app/static/js/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css index e9612408b..ceacd1304 100644 --- a/app/static/js/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css +++ b/app/static/js/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css @@ -311,7 +311,7 @@ div.CodeMirror-cursors { /* Used to force a border model for a node */ .cm-force-border { padding-right: .1px; } -@media { +@media print { /* Hide the cursor when printing */ .CodeMirror div.CodeMirror-cursors { visibility: hidden; diff --git a/app/templates/snips/studentHistoryModal.html b/app/templates/snips/studentHistoryModal.html index 69e26cfd9..497e70398 100755 --- a/app/templates/snips/studentHistoryModal.html +++ b/app/templates/snips/studentHistoryModal.html @@ -6,7 +6,7 @@ diff --git a/app/templates/snips/studentOverloadWithdraw.html b/app/templates/snips/studentOverloadWithdraw.html index a782b9bb2..2b0b2e943 100644 --- a/app/templates/snips/studentOverloadWithdraw.html +++ b/app/templates/snips/studentOverloadWithdraw.html @@ -14,7 +14,7 @@
Withdrawing will remove the overload request. A supervisor or admini From 8633056af021c4a3dbd366f3c14b17ee6f6eced9 Mon Sep 17 00:00:00 2001 From: glek <156453486+Kafui123@users.noreply.github.com> Date: Tue, 25 Nov 2025 21:08:52 +0000 Subject: [PATCH 22/32] reasons appearing on laborHistory as well --- app/controllers/main_routes/laborHistory.py | 23 ++++++++++++++++++- .../main_routes/studentOverloadApp.py | 2 +- app/templates/snips/studentHistoryModal.html | 5 ++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/app/controllers/main_routes/laborHistory.py b/app/controllers/main_routes/laborHistory.py index 887f15157..ec481a0a9 100755 --- a/app/controllers/main_routes/laborHistory.py +++ b/app/controllers/main_routes/laborHistory.py @@ -4,6 +4,7 @@ from fpdf import FPDF from urllib.parse import urlparse +from app.models import status from flask import render_template , flash, redirect, url_for, request, g, session, jsonify, current_app, send_file, json, make_response from flask_login import current_user, login_required from app.controllers.main_routes import * @@ -131,8 +132,15 @@ def populateModal(statusKey): currentUser = require_login() if not currentUser: # Not logged in return render_template('errors/403.html'), 403 + forms = (FormHistory.select().join(LaborReleaseForm, join_type=JOIN.LEFT_OUTER) .where(FormHistory.formID == statusKey).order_by(FormHistory.createdDate.desc(), FormHistory.formHistoryID.desc())) + # Find the FormHistory entry that has an overloadForm (same as overload modal behavior) + overload_history = None + for f in forms: + if f.overloadForm is not None: + overload_history = f + break statusForm = LaborStatusForm.get(LaborStatusForm.laborStatusFormID == statusKey) student = Student.get(Student.ID == statusForm.studentSupervisee) currentDate = datetime.date.today() @@ -178,14 +186,27 @@ def populateModal(statusKey): # Pending release or adjustment forms need the historyType known if (form.releaseForm != None or form.adjustedForm != None) and form.status.statusName == "Pending": pendingformType = form.historyType.historyTypeName + + try: + currentPendingForm = FormHistory.select().where( + (FormHistory.formID == statusForm) & + ((FormHistory.status == "Pending") | (FormHistory.status == "Pre-Student Approval")) + ).get() + status = currentPendingForm.status.statusName + except Exception: + status = None + + resp = make_response(render_template('snips/studentHistoryModal.html', forms = forms, currentUser = currentUser, statusForm = statusForm, currentDate = currentDate, pendingformType = pendingformType, - buttonState = buttonState + buttonState = buttonState, + status = status, + overload_history = overload_history, )) return (resp) except Exception as e: diff --git a/app/controllers/main_routes/studentOverloadApp.py b/app/controllers/main_routes/studentOverloadApp.py index a9fc34600..6e995c46e 100755 --- a/app/controllers/main_routes/studentOverloadApp.py +++ b/app/controllers/main_routes/studentOverloadApp.py @@ -94,7 +94,7 @@ def studentOverloadApp(formHistoryId): fieldName = adjustedChange.fieldAdjusted oldValue = adjustedChange.oldValue newValue = adjustedChange.newValue - + # this field is here to make the department names show up instead of org codes if fieldName == "department": oldDept = Department.get(Department.ORG == oldValue) newDept = Department.get(Department.ORG == newValue) diff --git a/app/templates/snips/studentHistoryModal.html b/app/templates/snips/studentHistoryModal.html index 497e70398..bef013710 100755 --- a/app/templates/snips/studentHistoryModal.html +++ b/app/templates/snips/studentHistoryModal.html @@ -40,6 +40,11 @@
End Date
{{statusForm.endDate.strftime('%m-%d-%Y')}}
+ + {% if overload_history %} +
Overload Reason
+
{{ overload_history.overloadForm.studentOverloadReason }}
+ {% endif %}
From e81926b46173a1ed6d08f7be893021bf00528571 Mon Sep 17 00:00:00 2001 From: Joyce J Nimely Date: Wed, 26 Nov 2025 21:51:38 +0000 Subject: [PATCH 23/32] Chnaged the overload reason to match the font of the other items --- app/templates/snips/studentHistoryModal.html | 10 +++++----- database/import-old-data/.DS_Store | Bin 0 -> 6148 bytes 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 database/import-old-data/.DS_Store diff --git a/app/templates/snips/studentHistoryModal.html b/app/templates/snips/studentHistoryModal.html index 6adaf0f49..41326b1c3 100755 --- a/app/templates/snips/studentHistoryModal.html +++ b/app/templates/snips/studentHistoryModal.html @@ -41,11 +41,11 @@
End Date
{{statusForm.endDate.strftime('%m-%d-%Y')}}
- {% if overload_history %} -
Overload Reason
-
{{ overload_history.overloadForm.studentOverloadReason }}
- {% endif %} - +
Overload Reason
+
+ {{ overload_history.overloadForm.studentOverloadReason or "None" }} +
+
{% for form in forms %} diff --git a/database/import-old-data/.DS_Store b/database/import-old-data/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Thu, 4 Dec 2025 01:25:45 +0000 Subject: [PATCH 24/32] Modifications to how overload form is gotten --- .../main_routes/studentOverloadApp.py | 47 ++++++++++--------- app/templates/main/studentOverloadApp.html | 2 +- app/templates/snips/pendingOverloadModal.html | 1 + 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/app/controllers/main_routes/studentOverloadApp.py b/app/controllers/main_routes/studentOverloadApp.py index 769a70022..c90e4a834 100755 --- a/app/controllers/main_routes/studentOverloadApp.py +++ b/app/controllers/main_routes/studentOverloadApp.py @@ -1,4 +1,5 @@ from datetime import date, datetime +from app.models import overloadForm from playhouse.shortcuts import model_to_dict from flask import json, jsonify, request, redirect, url_for, abort, flash, g @@ -17,7 +18,26 @@ @main_bp.route('/studentOverloadApp/', methods=['GET']) def studentOverloadApp(formHistoryId): currentUser = require_login() - overloadHistory = FormHistory.get_by_id(formHistoryId) + # always load the clicked history entry + currentHistory = FormHistory.get_by_id(formHistoryId) + + # STEP 2 — find the real FormHistory row that holds the overloadForm (reason) + reasonHistory = ( + FormHistory + .select() + .where( + (FormHistory.formID == currentHistory.formID) & + (FormHistory.overloadForm.is_null(False)) + ) + .order_by(FormHistory.createdDate.desc()) + .first() + ) + + # STEP 3 — use whichever record has the overloadForm, fallback to clicked one + if reasonHistory: + overloadHistory = reasonHistory + else: + overloadHistory = currentHistory if not currentUser.isLaborAdmin: if not currentUser: # Not logged in return render_template('errors/403.html'), 403 @@ -83,9 +103,6 @@ def studentOverloadApp(formHistoryId): totalCurrentHours += j.formID.weeklyHours totalFormHours = totalCurrentHours + prefillHoursOverload - # an overload can be created from a form adjustment. if it does, - # it means the overload form history links to an adjustment form that contains the adjusted data we want for the overload - adjustedField, oldValue, newValue = (None, None, None) if overloadHistory.adjustedForm: @@ -98,7 +115,6 @@ def studentOverloadApp(formHistoryId): if adjustedField == "department": oldValue = Department.get(Department.ORG == oldValue).DEPT_NAME newValue = Department.get(Department.ORG == newValue).DEPT_NAME - return render_template( 'main/studentOverloadApp.html', title=('student Overload Application'), username = currentUser, @@ -150,21 +166,18 @@ def updateDatabase(overloadFormHistoryID): if not overloadReason: abort(500) - # if status is pending that means we have an adjustment # if status is "pre-student then it means we have an overload" oldStatus = Status.get((Status.statusName == "Pre-Student Approval")) - newStatus = Status.get(Status.statusName == "Pending") overloadFormHistory = FormHistory.get(FormHistory.formHistoryID == overloadFormHistoryID) - - + originalFormHistory = (FormHistory.select() .where(FormHistory.formID == overloadFormHistory.formID) .where(FormHistory.status == oldStatus) @@ -177,7 +190,6 @@ def updateDatabase(overloadFormHistoryID): - with mainDB.atomic() as transaction: # Update statuses overloadFormHistory.status = newStatus @@ -193,21 +205,10 @@ def updateDatabase(overloadFormHistoryID): overloadForm = overloadFormHistory.overloadForm + overloadForm.studentOverloadReason = overloadReason + overloadForm.save() - # this line here for an adjustment form that has not created an overload form yet so we tie both of them together - if overloadForm is None: - overloadForm = OverloadForm.create(studentOverloadReason=overloadReason) - overloadForm.studentOverloadReason = overloadReason - overloadFormHistory.overloadForm = overloadForm - overloadFormHistory.save() - - else: - overloadForm.studentOverloadReason = overloadReason - overloadForm.save() - - - email = emailHandler(overloadFormHistory.formHistoryID) link = makeThirdPartyLink("Financial Aid", request.host, overloadFormHistory.formHistoryID) email.overloadVerification("Financial Aid", link) diff --git a/app/templates/main/studentOverloadApp.html b/app/templates/main/studentOverloadApp.html index d8f7d66ea..dbe6c5284 100755 --- a/app/templates/main/studentOverloadApp.html +++ b/app/templates/main/studentOverloadApp.html @@ -210,7 +210,7 @@

Requested Positions

- + diff --git a/app/templates/snips/pendingOverloadModal.html b/app/templates/snips/pendingOverloadModal.html index fcca4282f..db7a9679c 100644 --- a/app/templates/snips/pendingOverloadModal.html +++ b/app/templates/snips/pendingOverloadModal.html @@ -44,6 +44,7 @@