From 8698c84ebbcf66984393b6be35873b43e4740aa8 Mon Sep 17 00:00:00 2001 From: zhytkovd Date: Thu, 18 Jun 2026 20:14:52 +0000 Subject: [PATCH 1/9] Added body information to the email tracking table in the database --- app/logic/emailHandler.py | 18 +++++++++--------- app/models/emailTracker.py | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/logic/emailHandler.py b/app/logic/emailHandler.py index 1de8ef492..60d5c605c 100644 --- a/app/logic/emailHandler.py +++ b/app/logic/emailHandler.py @@ -347,11 +347,11 @@ def checkRecipient(self, studentEmailPurpose=False, emailPurpose=False, secondar # Depending on the parameter 'sendTo', this method will send the email either to the Primary, Secondary, or the Student def sendEmail(self, template, sendTo): + formTemplate = template.body formTemplate = self.replaceText(formTemplate) if sendTo == "student": - message = Message(template.subject, - recipients=[self.studentEmail]) + message = Message(template.subject, recipients = [self.studentEmail]) recipient = 'Student' elif sendTo == "secondary": if self.term.isBreak: @@ -363,8 +363,7 @@ def sendEmail(self, template, sendTo): recipients=supervisorEmails) recipient = 'Secondary Supervisor' else: - message = Message(template.subject, - recipients=[self.supervisorEmail, self.primaryEmail]) + message = Message(template.subject, recipients=[self.supervisorEmail, self.primaryEmail]) recipient = 'Primary Supervisor' elif sendTo == "Labor Office": message = Message(template.subject, @@ -375,18 +374,19 @@ def sendEmail(self, template, sendTo): recipients=[self.supervisorEmail]) recipient = 'Primary Supervisor' elif sendTo == "admin": - message = Message(template.subject, - recipients=[self.adminEmail]) + message = Message(template.subject, recipients=[self.adminEmail]) recipient = 'Admin' message.html = formTemplate - + newEmailTracker = EmailTracker.create( formID = self.laborStatusForm.laborStatusFormID, date = datetime.today().strftime('%Y-%m-%d'), recipient = recipient, - subject = template.subject + subject = template.subject, + # template = template.body, + body = formTemplate, + ) - self.send(message) # This method is responsible for replacing the keyword form the templates in the database with the data in the laborStatusForm diff --git a/app/models/emailTracker.py b/app/models/emailTracker.py index ff0495ebe..55fc4821d 100644 --- a/app/models/emailTracker.py +++ b/app/models/emailTracker.py @@ -7,3 +7,6 @@ class EmailTracker(baseModel): date = DateField() recipient = CharField() subject = CharField() + body = TextField() + # template = TextField() + From a0d361586c1a5e50ccbbea1bab440c8dc3507767 Mon Sep 17 00:00:00 2001 From: zhytkovd Date: Thu, 18 Jun 2026 21:04:05 +0000 Subject: [PATCH 2/9] made progress towards adding template and recepientEmails --- app/logic/emailHandler.py | 3 +-- app/models/emailTracker.py | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/logic/emailHandler.py b/app/logic/emailHandler.py index 60d5c605c..0d255cb97 100644 --- a/app/logic/emailHandler.py +++ b/app/logic/emailHandler.py @@ -383,9 +383,8 @@ def sendEmail(self, template, sendTo): date = datetime.today().strftime('%Y-%m-%d'), recipient = recipient, subject = template.subject, - # template = template.body, body = formTemplate, - + recipientEmails = ",".join(message.recipients) ) self.send(message) diff --git a/app/models/emailTracker.py b/app/models/emailTracker.py index 55fc4821d..03db02ad4 100644 --- a/app/models/emailTracker.py +++ b/app/models/emailTracker.py @@ -1,12 +1,15 @@ from app.models import * from app.models.laborStatusForm import LaborStatusForm +from app.models.emailTemplate import EmailTemplate class EmailTracker(baseModel): emailTrackerID = PrimaryKeyField() - formID = ForeignKeyField(LaborStatusForm, on_delete="cascade") # foreign key to lsf + formID = ForeignKeyField(LaborStatusForm) # foreign key to lsf date = DateField() recipient = CharField() subject = CharField() + templateID = ForeignKeyField(EmailTemplate) # foreign key to email template + recipientEmails = TextField() body = TextField() - # template = TextField() + From 1af112a4dd40e53dd827e70f95e2969a5124a48f Mon Sep 17 00:00:00 2001 From: zhytkovd Date: Fri, 19 Jun 2026 14:47:47 +0000 Subject: [PATCH 3/9] Added recipientEmails, templateID, body and removed subject to the emailtracker --- app/logic/emailHandler.py | 3 ++- app/models/emailTracker.py | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/logic/emailHandler.py b/app/logic/emailHandler.py index 0d255cb97..e7933206a 100644 --- a/app/logic/emailHandler.py +++ b/app/logic/emailHandler.py @@ -383,8 +383,9 @@ def sendEmail(self, template, sendTo): date = datetime.today().strftime('%Y-%m-%d'), recipient = recipient, subject = template.subject, + templateID = template.emailTemplateID, + recipientEmails = ",".join(message.recipients), body = formTemplate, - recipientEmails = ",".join(message.recipients) ) self.send(message) diff --git a/app/models/emailTracker.py b/app/models/emailTracker.py index 03db02ad4..c0b6ace7a 100644 --- a/app/models/emailTracker.py +++ b/app/models/emailTracker.py @@ -7,7 +7,6 @@ class EmailTracker(baseModel): formID = ForeignKeyField(LaborStatusForm) # foreign key to lsf date = DateField() recipient = CharField() - subject = CharField() templateID = ForeignKeyField(EmailTemplate) # foreign key to email template recipientEmails = TextField() body = TextField() From 304c70df9078df2cea5e56579e04f7d5f1c3d496 Mon Sep 17 00:00:00 2001 From: zhytkovd Date: Mon, 22 Jun 2026 14:42:46 +0000 Subject: [PATCH 4/9] New redactions to data dumps.New data to test redactions. New data collected is in emailTracker --- app/models/emailTracker.py | 2 +- database/data-scrub.sql | 4 + database/demo_data.py | 819 +++++++++++++++++++------------------ 3 files changed, 421 insertions(+), 404 deletions(-) diff --git a/app/models/emailTracker.py b/app/models/emailTracker.py index c0b6ace7a..5bdfa4e6f 100644 --- a/app/models/emailTracker.py +++ b/app/models/emailTracker.py @@ -7,7 +7,7 @@ class EmailTracker(baseModel): formID = ForeignKeyField(LaborStatusForm) # foreign key to lsf date = DateField() recipient = CharField() - templateID = ForeignKeyField(EmailTemplate) # foreign key to email template + templateID = ForeignKeyField(EmailTemplate) # foreign key to email template 4 recipientEmails = TextField() body = TextField() diff --git a/database/data-scrub.sql b/database/data-scrub.sql index af3c3125d..719cfb21e 100644 --- a/database/data-scrub.sql +++ b/database/data-scrub.sql @@ -12,3 +12,7 @@ UPDATE laborstatusform set laborDepartmentNotes=CASE WHEN LENGTH(laborDepartment UPDATE notes set notesContents='Notes are not visible except in the production environment' UPDATE studentlaborevaluation SET attendance_comment=CASE WHEN LENGTH(attendance_comment)>0 THEN '' ELSE '' END, accountability_comment=CASE WHEN LENGTH(accountability_comment)>0 THEN '' ELSE '' END, teamwork_comment=CASE WHEN LENGTH(teamwork_comment)>0 THEN '' ELSE '' END, initiative_comment=CASE WHEN LENGTH(initiative_comment)>0 THEN '' ELSE '' END, respect_comment=CASE WHEN LENGTH(respect_comment)>0 THEN '' ELSE '' END, learning_comment=CASE WHEN LENGTH(learning_comment)>0 THEN '' ELSE '' END, jobSpecific_comment=CASE WHEN LENGTH(jobSpecific_comment)>0 THEN '' ELSE '' END, transcript_comment=CASE WHEN LENGTH(transcript_comment)>0 THEN '' ELSE '' END + +-- removes parts of the email tracker +UPDATE emailtracker set recipientEmails=CASE WHEN LENGTH(recipientEmails)>0 THEN '' ELSE '' END +UPDATE emailtracker set body=CASE WHEN LENGTH(body)>0 THEN '' ELSE '' END \ No newline at end of file diff --git a/database/demo_data.py b/database/demo_data.py index 0557c9361..096fca88f 100644 --- a/database/demo_data.py +++ b/database/demo_data.py @@ -17,6 +17,7 @@ from app.models.laborStatusForm import LaborStatusForm from app.models.formHistory import FormHistory from app.models.notes import Notes +from app.models.emailTracker import EmailTracker print("Inserting data for demo and testing purposes") @@ -24,131 +25,131 @@ # Students (TRACY) ############################# bothStudents = [ - { - "ID":"B12345773", - "PIDM":"57", - "FIRST_NAME":"Test", - "LAST_NAME":"Taker", - "CLASS_LEVEL":"Sophmore", - "ACADEMIC_FOCUS":"Computer Science", - "MAJOR":"Computer Science", - "PROBATION":"0", - "ADVISOR":"Jan Pearce", - "STU_EMAIL":"student@berea.edu", - "STU_CPO":"700", - "LAST_POSN":"Media Technician", - "LAST_SUP_PIDM":"7" - }, - - { - "ID":"B00730361", - "PIDM":"1", - "FIRST_NAME":"Elaheh", - "LAST_NAME":"Jamali", - "CLASS_LEVEL":"Junior", - "ACADEMIC_FOCUS":"Computer Science", - "MAJOR":"Computer Science", - "PROBATION":"0", - "ADVISOR":"Jan Pearce", - "STU_EMAIL":"jamalie@berea.edu", - "STU_CPO":"718", - "LAST_POSN":"Media Technician", - "LAST_SUP_PIDM":"7" - }, - { - "ID":"B00734292", - "PIDM":"3", - "FIRST_NAME":"Guillermo", - "LAST_NAME":"Adams", # Guillermo's last name is wrong on purpose - "CLASS_LEVEL":"Junior", - "ACADEMIC_FOCUS":"Computer Science", - "MAJOR":"Computer Science", - "PROBATION":"0", - "ADVISOR":"Jan Pearce", - "STU_EMAIL":"cruzg@berea.edu", - "STU_CPO":"300", - "LAST_POSN":"TA", - "LAST_SUP_PIDM":"7" - }, - { - "ID":"B00791326", - "PIDM":"9", - "FIRST_NAME":"Oluwagbayi", - "LAST_NAME":"Makinde", - "CLASS_LEVEL":"Junior", - "ACADEMIC_FOCUS":"Computer Science", - "MAJOR":"Computer Science", - "PROBATION":"0", - "ADVISOR":"Jan Pearce", - "STU_EMAIL":"makindeo@berea.edu", - "STU_CPO":"883", - "LAST_POSN":"TA", - "LAST_SUP_PIDM":"7" - }, - ] + { + "ID": "B12345773", + "PIDM": "57", + "FIRST_NAME": "Test", + "LAST_NAME": "Taker", + "CLASS_LEVEL": "Sophmore", + "ACADEMIC_FOCUS": "Computer Science", + "MAJOR": "Computer Science", + "PROBATION": "0", + "ADVISOR": "Jan Pearce", + "STU_EMAIL": "student@berea.edu", + "STU_CPO": "700", + "LAST_POSN": "Media Technician", + "LAST_SUP_PIDM": "7" + }, + + { + "ID": "B00730361", + "PIDM": "1", + "FIRST_NAME": "Elaheh", + "LAST_NAME": "Jamali", + "CLASS_LEVEL": "Junior", + "ACADEMIC_FOCUS": "Computer Science", + "MAJOR": "Computer Science", + "PROBATION": "0", + "ADVISOR": "Jan Pearce", + "STU_EMAIL": "jamalie@berea.edu", + "STU_CPO": "718", + "LAST_POSN": "Media Technician", + "LAST_SUP_PIDM": "7" + }, + { + "ID": "B00734292", + "PIDM": "3", + "FIRST_NAME": "Guillermo", + "LAST_NAME": "Adams", # Guillermo's last name is wrong on purpose + "CLASS_LEVEL": "Junior", + "ACADEMIC_FOCUS": "Computer Science", + "MAJOR": "Computer Science", + "PROBATION": "0", + "ADVISOR": "Jan Pearce", + "STU_EMAIL": "cruzg@berea.edu", + "STU_CPO": "300", + "LAST_POSN": "TA", + "LAST_SUP_PIDM": "7" + }, + { + "ID": "B00791326", + "PIDM": "9", + "FIRST_NAME": "Oluwagbayi", + "LAST_NAME": "Makinde", + "CLASS_LEVEL": "Junior", + "ACADEMIC_FOCUS": "Computer Science", + "MAJOR": "Computer Science", + "PROBATION": "0", + "ADVISOR": "Jan Pearce", + "STU_EMAIL": "makindeo@berea.edu", + "STU_CPO": "883", + "LAST_POSN": "TA", + "LAST_SUP_PIDM": "7" + }, +] localStudents = [ - { - "ID":"B00841417", - "PIDM":"2", - "FIRST_NAME":"Alex", - "LAST_NAME":"Bryant", - "CLASS_LEVEL":"Senior", - "ACADEMIC_FOCUS":"Computer Science", - "MAJOR":"Computer Science", - "PROBATION":"0", - "ADVISOR":"Scott Heggen", - "STU_EMAIL":"bryantal@berea.edu", - "STU_CPO":"212", - "LAST_POSN":"Student Manager", - "LAST_SUP_PIDM":"7" - }, - ] + { + "ID": "B00841417", + "PIDM": "2", + "FIRST_NAME": "Alex", + "LAST_NAME": "Bryant", + "CLASS_LEVEL": "Senior", + "ACADEMIC_FOCUS": "Computer Science", + "MAJOR": "Computer Science", + "PROBATION": "0", + "ADVISOR": "Scott Heggen", + "STU_EMAIL": "bryantal@berea.edu", + "STU_CPO": "212", + "LAST_POSN": "Student Manager", + "LAST_SUP_PIDM": "7" + }, +] tracyStudents = [ - { - "ID":"B00785329", - "PIDM":"4", - "FIRST_NAME":"Kat", - "LAST_NAME":"Adams", - "CLASS_LEVEL":"Senior", - "ACADEMIC_FOCUS":"Computer Science", - "MAJOR":"Computer Science", - "PROBATION":"0", - "ADVISOR":"Scott Heggen", - "STU_EMAIL":"adamskg@berea.edu", - "STU_CPO":"420", - "LAST_POSN":"TA", - "LAST_SUP_PIDM":"7" - }, - { - "ID":"B00888329", - "PIDM":"7", - "FIRST_NAME":"Jeremiah", - "LAST_NAME":"Bullfrog", - "CLASS_LEVEL":"Senior", - "ACADEMIC_FOCUS":"Computer Science", - "MAJOR":"Computer Science", - "PROBATION":"0", - "ADVISOR":"Scott Heggen", - "STU_EMAIL":"bullfrogj@berea.edu", - "STU_CPO":"420", - "LAST_POSN":"TA", - "LAST_SUP_PIDM":"7" - }, - { - "ID":"B00751360", - "PIDM":"90", - "FIRST_NAME":"Tyler", - "LAST_NAME":"Parton", - "CLASS_LEVEL":"Senior", - "ACADEMIC_FOCUS":"Computer Science", - "MAJOR":"Computer Science", - "PROBATION":"0", - "ADVISOR":"Scott Heggen", - "STU_EMAIL":"partont@berea.edu", - "STU_CPO":"420", - "LAST_POSN":"TA", - "LAST_SUP_PIDM":"7" - } + { + "ID": "B00785329", + "PIDM": "4", + "FIRST_NAME": "Kat", + "LAST_NAME": "Adams", + "CLASS_LEVEL": "Senior", + "ACADEMIC_FOCUS": "Computer Science", + "MAJOR": "Computer Science", + "PROBATION": "0", + "ADVISOR": "Scott Heggen", + "STU_EMAIL": "adamskg@berea.edu", + "STU_CPO": "420", + "LAST_POSN": "TA", + "LAST_SUP_PIDM": "7" + }, + { + "ID": "B00888329", + "PIDM": "7", + "FIRST_NAME": "Jeremiah", + "LAST_NAME": "Bullfrog", + "CLASS_LEVEL": "Senior", + "ACADEMIC_FOCUS": "Computer Science", + "MAJOR": "Computer Science", + "PROBATION": "0", + "ADVISOR": "Scott Heggen", + "STU_EMAIL": "bullfrogj@berea.edu", + "STU_CPO": "420", + "LAST_POSN": "TA", + "LAST_SUP_PIDM": "7" + }, + { + "ID": "B00751360", + "PIDM": "90", + "FIRST_NAME": "Tyler", + "LAST_NAME": "Parton", + "CLASS_LEVEL": "Senior", + "ACADEMIC_FOCUS": "Computer Science", + "MAJOR": "Computer Science", + "PROBATION": "0", + "ADVISOR": "Scott Heggen", + "STU_EMAIL": "partont@berea.edu", + "STU_CPO": "420", + "LAST_POSN": "TA", + "LAST_SUP_PIDM": "7" + } ] # Add students to Tracy db @@ -174,86 +175,86 @@ # Positions (TRACY) ############################# positions = [ - { - "POSN_CODE": "S61407", - "POSN_TITLE": "Student Programmer", - "WLS": "1", - "ORG" : "2114", - "ACCOUNT":"6740", - "DEPT_NAME":"Computer Science" - }, - { - "POSN_CODE": "S61408", - "POSN_TITLE": "Research Associate", - "WLS": "5", - "ORG" : "2114", - "ACCOUNT":"6740", - "DEPT_NAME":"Computer Science" - }, - { - "POSN_CODE": "S61419", - "POSN_TITLE": "Teaching Associate", - "WLS": "3", - "ORG" : "2114", - "ACCOUNT":"6740", - "DEPT_NAME":"Computer Science" - }, - { - "POSN_CODE": "S61420", - "POSN_TITLE": "Teaching Associate", - "WLS": "5", - "ORG" : "2147", - "ACCOUNT":"6740", - "DEPT_NAME":"Technology and Applied Design" - }, - { - "POSN_CODE": "S61421", - "POSN_TITLE": "TA", - "WLS": "6", - "ORG" : "2114", - "ACCOUNT":"6740", - "DEPT_NAME":"Computer Science" - }, - { - "POSN_CODE": "S61427", - "POSN_TITLE": "Teaching Associate", - "WLS": "2", - "ORG" : "2150", - "ACCOUNT":"6740", - "DEPT_NAME":"Mathematics" - }, - { - "POSN_CODE": "S61430", - "POSN_TITLE": "Teaching Associate", - "WLS": "5", - "ORG" : "2107", - "ACCOUNT":"6740", - "DEPT_NAME":"Biology" - }, - { - "POSN_CODE": "S61443", - "POSN_TITLE": "Lab Assistant", - "WLS": "6", - "ORG" : "2107", - "ACCOUNT":"6740", - "DEPT_NAME":"Biology" - }, - { - "POSN_CODE": "S12345", - "POSN_TITLE": "DUMMY POSITION", - "WLS": "3", - "ORG" : "2114", - "ACCOUNT":"6740", - "DEPT_NAME":"Computer Science" - }, - { - "POSN_CODE": "S61409", - "POSN_TITLE": "Labor Workers", - "WLS": "1", - "ORG" : "4022", - "ACCOUNT":"6740", - "DEPT_NAME":"Labor Department" - } + { + "POSN_CODE": "S61407", + "POSN_TITLE": "Student Programmer", + "WLS": "1", + "ORG": "2114", + "ACCOUNT": "6740", + "DEPT_NAME": "Computer Science" + }, + { + "POSN_CODE": "S61408", + "POSN_TITLE": "Research Associate", + "WLS": "5", + "ORG": "2114", + "ACCOUNT": "6740", + "DEPT_NAME": "Computer Science" + }, + { + "POSN_CODE": "S61419", + "POSN_TITLE": "Teaching Associate", + "WLS": "3", + "ORG": "2114", + "ACCOUNT": "6740", + "DEPT_NAME": "Computer Science" + }, + { + "POSN_CODE": "S61420", + "POSN_TITLE": "Teaching Associate", + "WLS": "5", + "ORG": "2147", + "ACCOUNT": "6740", + "DEPT_NAME": "Technology and Applied Design" + }, + { + "POSN_CODE": "S61421", + "POSN_TITLE": "TA", + "WLS": "6", + "ORG": "2114", + "ACCOUNT": "6740", + "DEPT_NAME": "Computer Science" + }, + { + "POSN_CODE": "S61427", + "POSN_TITLE": "Teaching Associate", + "WLS": "2", + "ORG": "2150", + "ACCOUNT": "6740", + "DEPT_NAME": "Mathematics" + }, + { + "POSN_CODE": "S61430", + "POSN_TITLE": "Teaching Associate", + "WLS": "5", + "ORG": "2107", + "ACCOUNT": "6740", + "DEPT_NAME": "Biology" + }, + { + "POSN_CODE": "S61443", + "POSN_TITLE": "Lab Assistant", + "WLS": "6", + "ORG": "2107", + "ACCOUNT": "6740", + "DEPT_NAME": "Biology" + }, + { + "POSN_CODE": "S12345", + "POSN_TITLE": "DUMMY POSITION", + "WLS": "3", + "ORG": "2114", + "ACCOUNT": "6740", + "DEPT_NAME": "Computer Science" + }, + { + "POSN_CODE": "S61409", + "POSN_TITLE": "Labor Workers", + "WLS": "1", + "ORG": "4022", + "ACCOUNT": "6740", + "DEPT_NAME": "Labor Department" + } ] # Add to Tracy db @@ -269,90 +270,90 @@ ############################# staffs = [ - { - "ID": "B12361006", - "PIDM":1, - "FIRST_NAME":"Scott", - "LAST_NAME" : "Heggen", - "EMAIL" :"heggens@berea.edu", - "CPO":"6300", - "ORG":"2114", - "DEPT_NAME": "Computer Science" - }, - { - "ID": "B00769499", - "PIDM":28, - "FIRST_NAME":"Madina", - "LAST_NAME" : "Solijonova", - "EMAIL" :"solijonovam@berea.edu", - "CPO":"6300", - "ORG":"2114", - "DEPT_NAME": "Computer Science" - }, - { - "ID": "B12365892", - "PIDM":2, - "FIRST_NAME":"Jan", - "LAST_NAME" : "Pearce", - "EMAIL" :"pearcej@berea.edu", - "CPO":"6301", - "ORG":"2114", - "DEPT_NAME": "Computer Science" - }, - { - "ID": "B12365893", - "PIDM":5, - "FIRST_NAME":"Jasmine", - "LAST_NAME" : "Jones", - "EMAIL" :"jonesj@berea.edu", - "CPO":"6301", - "ORG":"2114", - "DEPT_NAME": "Computer Science" - }, - { - "ID": "B00763721", - "PIDM":6, - "FIRST_NAME":"Brian", - "LAST_NAME" : "Ramsay", - "EMAIL" :"ramsayb2@berea.edu", - "CPO":"6305", - "ORG":"2114", - "DEPT_NAME": "Computer Science" - }, - { - "ID": "B00841417", - "PIDM":7, - "FIRST_NAME":"Alex", - "LAST_NAME" : "Bryant", - "EMAIL" :"bryantal@berea.edu", - "CPO":"420", - "ORG":"2114", - "DEPT_NAME": "Computer Science" - } - ] + { + "ID": "B12361006", + "PIDM": 1, + "FIRST_NAME": "Scott", + "LAST_NAME": "Heggen", + "EMAIL": "heggens@berea.edu", + "CPO": "6300", + "ORG": "2114", + "DEPT_NAME": "Computer Science" + }, + { + "ID": "B00769499", + "PIDM": 28, + "FIRST_NAME": "Madina", + "LAST_NAME": "Solijonova", + "EMAIL": "solijonovam@berea.edu", + "CPO": "6300", + "ORG": "2114", + "DEPT_NAME": "Computer Science" + }, + { + "ID": "B12365892", + "PIDM": 2, + "FIRST_NAME": "Jan", + "LAST_NAME": "Pearce", + "EMAIL": "pearcej@berea.edu", + "CPO": "6301", + "ORG": "2114", + "DEPT_NAME": "Computer Science" + }, + { + "ID": "B12365893", + "PIDM": 5, + "FIRST_NAME": "Jasmine", + "LAST_NAME": "Jones", + "EMAIL": "jonesj@berea.edu", + "CPO": "6301", + "ORG": "2114", + "DEPT_NAME": "Computer Science" + }, + { + "ID": "B00763721", + "PIDM": 6, + "FIRST_NAME": "Brian", + "LAST_NAME": "Ramsay", + "EMAIL": "ramsayb2@berea.edu", + "CPO": "6305", + "ORG": "2114", + "DEPT_NAME": "Computer Science" + }, + { + "ID": "B00841417", + "PIDM": 7, + "FIRST_NAME": "Alex", + "LAST_NAME": "Bryant", + "EMAIL": "bryantal@berea.edu", + "CPO": "420", + "ORG": "2114", + "DEPT_NAME": "Computer Science" + } +] non_supervisor_staffs = [ - { - "ID": "B1236237", - "PIDM":4, - "FIRST_NAME":"Megan", - "LAST_NAME" : "Hoffman", - "EMAIL" :"hoffmanm@berea.edu", - "CPO":"6303", - "ORG":"2107", - "DEPT_NAME": "Biology" - }, - { - "ID": "B1236236", - "PIDM":3, - "FIRST_NAME":"Mario", - "LAST_NAME" : "Nakazawa", - "EMAIL" :"nakazawam@berea.edu", - "CPO":"6302", - "ORG":"2150", - "DEPT_NAME": "Mathematics" - } - ] + { + "ID": "B1236237", + "PIDM": 4, + "FIRST_NAME": "Megan", + "LAST_NAME": "Hoffman", + "EMAIL": "hoffmanm@berea.edu", + "CPO": "6303", + "ORG": "2107", + "DEPT_NAME": "Biology" + }, + { + "ID": "B1236236", + "PIDM": 3, + "FIRST_NAME": "Mario", + "LAST_NAME": "Nakazawa", + "EMAIL": "nakazawam@berea.edu", + "CPO": "6302", + "ORG": "2150", + "DEPT_NAME": "Mathematics" + } +] # Add to Tracy db with app.app_context(): @@ -376,126 +377,125 @@ # Users ############################# users = [ - { + { "student": None, "supervisor": "B12361006", "username": "heggens", "isLaborAdmin": 1, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": None, "supervisor": "B12365892", "username": "pearcej", "isLaborAdmin": None, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": None, "supervisor": "B12365893", "username": "jonesj", "isLaborAdmin": None, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": None, "supervisor": "B00763721", "username": "ramsayb2", "isLaborAdmin": 1, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": "B00730361", "supervisor": None, "username": "jamalie", "isLaborAdmin": None, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": "B00734292", "supervisor": None, "username": "cruzg", "isLaborAdmin": None, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": "B00791326", "supervisor": None, "username": "makindeo", "isLaborAdmin": None, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": "B00841417", "supervisor": "B00841417", "username": "bryantal", "isLaborAdmin": None, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": "B12345773", "supervisor": None, "username": "test1", "isLaborAdmin": None, "isFinancialAidAdmin": None, "isSaasAdmin": None - } - ] + } +] User.insert_many(users).on_conflict_replace().execute() print(" * users added") - ############################# # Department ############################# departments = [ - { - "departmentID":1, - "DEPT_NAME": "Computer Science", - "ACCOUNT": "6740", - "ORG": "2114", - "departmentCompliance": 1 - }, - { - "departmentID":2, - "DEPT_NAME": "Technology and Applied Design", - "ACCOUNT": "6740", - "ORG": "2147", - "departmentCompliance": 1 - }, - { - "departmentID":3, - "DEPT_NAME": "Mathematics", - "ACCOUNT": "6740", - "ORG": "2150", - "departmentCompliance": 1 - }, - { - "departmentID":4, - "DEPT_NAME": "Biology", - "ACCOUNT": "6740", - "ORG": "2107", - "departmentCompliance": 1 - }, - { - "departmentID":5, - "DEPT_NAME": "Labor Department", - "ACCOUNT": "6740", - "ORG": "4022", - "departmentCompliance": 1, - "isActive": 1 - } - - ] + { + "departmentID": 1, + "DEPT_NAME": "Computer Science", + "ACCOUNT": "6740", + "ORG": "2114", + "departmentCompliance": 1 + }, + { + "departmentID": 2, + "DEPT_NAME": "Technology and Applied Design", + "ACCOUNT": "6740", + "ORG": "2147", + "departmentCompliance": 1 + }, + { + "departmentID": 3, + "DEPT_NAME": "Mathematics", + "ACCOUNT": "6740", + "ORG": "2150", + "departmentCompliance": 1 + }, + { + "departmentID": 4, + "DEPT_NAME": "Biology", + "ACCOUNT": "6740", + "ORG": "2107", + "departmentCompliance": 1 + }, + { + "departmentID": 5, + "DEPT_NAME": "Labor Department", + "ACCOUNT": "6740", + "ORG": "4022", + "departmentCompliance": 1, + "isActive": 1 + } + +] Department.insert_many(departments).on_conflict_replace().execute() print(" * departments added") @@ -536,76 +536,89 @@ today = datetime.now() current_year = today.year - (today.month < 8) LaborStatusForm.insert([{ - "laborStatusFormID": 2, - "termCode_id": f"{current_year}00", - "studentName": "Alex Bryant", - "studentSupervisee_id": "B00841417", - "supervisor_id": "B12361006", - "department_id": 1, - "jobType": "Primary", - "WLS": 1, - "POSN_TITLE": "Student Programmer", - "POSN_CODE": "S61407", - "weeklyHours": 10, - "startDate": f"{current_year}-04-01", - "endDate": f"{current_year}-09-01" - }]).on_conflict_replace().execute() + "laborStatusFormID": 2, + "termCode_id": f"{current_year}00", + "studentName": "Alex Bryant", + "studentSupervisee_id": "B00841417", + "supervisor_id": "B12361006", + "department_id": 1, + "jobType": "Primary", + "WLS": 1, + "POSN_TITLE": "Student Programmer", + "POSN_CODE": "S61407", + "weeklyHours": 10, + "startDate": f"{current_year}-04-01", + "endDate": f"{current_year}-09-01" +}]).on_conflict_replace().execute() FormHistory.insert([{ - "formHistoryID": 2, - "formID_id": "2", - "historyType_id": "Labor Status Form", - "createdBy_id": 1, - "createdDate": f"{current_year}-04-14", - "status_id": "Pending" - }]).on_conflict_replace().execute() + "formHistoryID": 2, + "formID_id": "2", + "historyType_id": "Labor Status Form", + "createdBy_id": 1, + "createdDate": f"{current_year}-04-14", + "status_id": "Pending" +}]).on_conflict_replace().execute() LaborStatusForm.insert([{ - "laborStatusFormID": 3, - "termCode_id": f"{current_year}00", - "studentName": "Test Taker", - "studentSupervisee_id": "B12345773", - "supervisor_id": "B12361006", - "department_id": 5, - "jobType": "Primary", - "WLS": 1, - "POSN_TITLE": "Labor Workers", - "POSN_CODE": "S61409", - "weeklyHours": 10, - "startDate": f"{current_year}-04-01", - "endDate": "2025-09-01" - }]).on_conflict_replace().execute() + "laborStatusFormID": 3, + "termCode_id": f"{current_year}00", + "studentName": "Test Taker", + "studentSupervisee_id": "B12345773", + "supervisor_id": "B12361006", + "department_id": 5, + "jobType": "Primary", + "WLS": 1, + "POSN_TITLE": "Labor Workers", + "POSN_CODE": "S61409", + "weeklyHours": 10, + "startDate": f"{current_year}-04-01", + "endDate": "2025-09-01" +}]).on_conflict_replace().execute() FormHistory.insert([{ - "formHistoryID": 3, - "formID_id": "3", - "historyType_id": "Labor Status Form", - "createdBy_id": 1, - "createdDate": f"{current_year}-04-14", - "status_id": "Approved" - }]).on_conflict_replace().execute() - + "formHistoryID": 3, + "formID_id": "3", + "historyType_id": "Labor Status Form", + "createdBy_id": 1, + "createdDate": f"{current_year}-04-14", + "status_id": "Approved" +}]).on_conflict_replace().execute() ############################# # admin Notes ############################# notes = [ - { - "noteHistoryID": 1, - "formID_id": 2, - "date":"2020-01-01", - "createdBy" : 1, - "notesContents": "This is the first note", - "noteType" : "Supervisor Note" - }, - { - "noteHistoryID": 2, - "formID_id": 2, - "date":"2020-02-01", - "createdBy" : 1, - "notesContents": "This is the second note", - "noteType" : "Labor Note" - }, - ] + { + "noteHistoryID": 1, + "formID_id": 2, + "date": "2020-01-01", + "createdBy": 1, + "notesContents": "This is the first note", + "noteType": "Supervisor Note" + }, + { + "noteHistoryID": 2, + "formID_id": 2, + "date": "2020-02-01", + "createdBy": 1, + "notesContents": "This is the second note", + "noteType": "Labor Note" + }, +] Notes.insert_many(notes).on_conflict_replace().execute() print(" * laborOfficeNotes added") + + +############################# +# Creates an emailTracker +############################# +EmailTracker.insert([{ + "emailTrackerID": 1, + "formID": 2, + "date": "2026-06-18", + "recipient": "test guy", + "templateID": 4, + "recipientEmails": "coolguy@email.com", + "body": "super secret text that you cant read" +}]).on_conflict_replace().execute() From 2f2f64b3db2112c1ab56e64a795108cda66a5945 Mon Sep 17 00:00:00 2001 From: zhytkovd Date: Mon, 22 Jun 2026 14:59:23 +0000 Subject: [PATCH 5/9] Revert "New redactions to data dumps.New data to test redactions. New data collected is in emailTracker" This reverts commit 304c70df9078df2cea5e56579e04f7d5f1c3d496. --- app/models/emailTracker.py | 2 +- database/data-scrub.sql | 4 - database/demo_data.py | 819 ++++++++++++++++++------------------- 3 files changed, 404 insertions(+), 421 deletions(-) diff --git a/app/models/emailTracker.py b/app/models/emailTracker.py index 5bdfa4e6f..c0b6ace7a 100644 --- a/app/models/emailTracker.py +++ b/app/models/emailTracker.py @@ -7,7 +7,7 @@ class EmailTracker(baseModel): formID = ForeignKeyField(LaborStatusForm) # foreign key to lsf date = DateField() recipient = CharField() - templateID = ForeignKeyField(EmailTemplate) # foreign key to email template 4 + templateID = ForeignKeyField(EmailTemplate) # foreign key to email template recipientEmails = TextField() body = TextField() diff --git a/database/data-scrub.sql b/database/data-scrub.sql index 719cfb21e..af3c3125d 100644 --- a/database/data-scrub.sql +++ b/database/data-scrub.sql @@ -12,7 +12,3 @@ UPDATE laborstatusform set laborDepartmentNotes=CASE WHEN LENGTH(laborDepartment UPDATE notes set notesContents='Notes are not visible except in the production environment' UPDATE studentlaborevaluation SET attendance_comment=CASE WHEN LENGTH(attendance_comment)>0 THEN '' ELSE '' END, accountability_comment=CASE WHEN LENGTH(accountability_comment)>0 THEN '' ELSE '' END, teamwork_comment=CASE WHEN LENGTH(teamwork_comment)>0 THEN '' ELSE '' END, initiative_comment=CASE WHEN LENGTH(initiative_comment)>0 THEN '' ELSE '' END, respect_comment=CASE WHEN LENGTH(respect_comment)>0 THEN '' ELSE '' END, learning_comment=CASE WHEN LENGTH(learning_comment)>0 THEN '' ELSE '' END, jobSpecific_comment=CASE WHEN LENGTH(jobSpecific_comment)>0 THEN '' ELSE '' END, transcript_comment=CASE WHEN LENGTH(transcript_comment)>0 THEN '' ELSE '' END - --- removes parts of the email tracker -UPDATE emailtracker set recipientEmails=CASE WHEN LENGTH(recipientEmails)>0 THEN '' ELSE '' END -UPDATE emailtracker set body=CASE WHEN LENGTH(body)>0 THEN '' ELSE '' END \ No newline at end of file diff --git a/database/demo_data.py b/database/demo_data.py index 096fca88f..0557c9361 100644 --- a/database/demo_data.py +++ b/database/demo_data.py @@ -17,7 +17,6 @@ from app.models.laborStatusForm import LaborStatusForm from app.models.formHistory import FormHistory from app.models.notes import Notes -from app.models.emailTracker import EmailTracker print("Inserting data for demo and testing purposes") @@ -25,131 +24,131 @@ # Students (TRACY) ############################# bothStudents = [ - { - "ID": "B12345773", - "PIDM": "57", - "FIRST_NAME": "Test", - "LAST_NAME": "Taker", - "CLASS_LEVEL": "Sophmore", - "ACADEMIC_FOCUS": "Computer Science", - "MAJOR": "Computer Science", - "PROBATION": "0", - "ADVISOR": "Jan Pearce", - "STU_EMAIL": "student@berea.edu", - "STU_CPO": "700", - "LAST_POSN": "Media Technician", - "LAST_SUP_PIDM": "7" - }, - - { - "ID": "B00730361", - "PIDM": "1", - "FIRST_NAME": "Elaheh", - "LAST_NAME": "Jamali", - "CLASS_LEVEL": "Junior", - "ACADEMIC_FOCUS": "Computer Science", - "MAJOR": "Computer Science", - "PROBATION": "0", - "ADVISOR": "Jan Pearce", - "STU_EMAIL": "jamalie@berea.edu", - "STU_CPO": "718", - "LAST_POSN": "Media Technician", - "LAST_SUP_PIDM": "7" - }, - { - "ID": "B00734292", - "PIDM": "3", - "FIRST_NAME": "Guillermo", - "LAST_NAME": "Adams", # Guillermo's last name is wrong on purpose - "CLASS_LEVEL": "Junior", - "ACADEMIC_FOCUS": "Computer Science", - "MAJOR": "Computer Science", - "PROBATION": "0", - "ADVISOR": "Jan Pearce", - "STU_EMAIL": "cruzg@berea.edu", - "STU_CPO": "300", - "LAST_POSN": "TA", - "LAST_SUP_PIDM": "7" - }, - { - "ID": "B00791326", - "PIDM": "9", - "FIRST_NAME": "Oluwagbayi", - "LAST_NAME": "Makinde", - "CLASS_LEVEL": "Junior", - "ACADEMIC_FOCUS": "Computer Science", - "MAJOR": "Computer Science", - "PROBATION": "0", - "ADVISOR": "Jan Pearce", - "STU_EMAIL": "makindeo@berea.edu", - "STU_CPO": "883", - "LAST_POSN": "TA", - "LAST_SUP_PIDM": "7" - }, -] + { + "ID":"B12345773", + "PIDM":"57", + "FIRST_NAME":"Test", + "LAST_NAME":"Taker", + "CLASS_LEVEL":"Sophmore", + "ACADEMIC_FOCUS":"Computer Science", + "MAJOR":"Computer Science", + "PROBATION":"0", + "ADVISOR":"Jan Pearce", + "STU_EMAIL":"student@berea.edu", + "STU_CPO":"700", + "LAST_POSN":"Media Technician", + "LAST_SUP_PIDM":"7" + }, + + { + "ID":"B00730361", + "PIDM":"1", + "FIRST_NAME":"Elaheh", + "LAST_NAME":"Jamali", + "CLASS_LEVEL":"Junior", + "ACADEMIC_FOCUS":"Computer Science", + "MAJOR":"Computer Science", + "PROBATION":"0", + "ADVISOR":"Jan Pearce", + "STU_EMAIL":"jamalie@berea.edu", + "STU_CPO":"718", + "LAST_POSN":"Media Technician", + "LAST_SUP_PIDM":"7" + }, + { + "ID":"B00734292", + "PIDM":"3", + "FIRST_NAME":"Guillermo", + "LAST_NAME":"Adams", # Guillermo's last name is wrong on purpose + "CLASS_LEVEL":"Junior", + "ACADEMIC_FOCUS":"Computer Science", + "MAJOR":"Computer Science", + "PROBATION":"0", + "ADVISOR":"Jan Pearce", + "STU_EMAIL":"cruzg@berea.edu", + "STU_CPO":"300", + "LAST_POSN":"TA", + "LAST_SUP_PIDM":"7" + }, + { + "ID":"B00791326", + "PIDM":"9", + "FIRST_NAME":"Oluwagbayi", + "LAST_NAME":"Makinde", + "CLASS_LEVEL":"Junior", + "ACADEMIC_FOCUS":"Computer Science", + "MAJOR":"Computer Science", + "PROBATION":"0", + "ADVISOR":"Jan Pearce", + "STU_EMAIL":"makindeo@berea.edu", + "STU_CPO":"883", + "LAST_POSN":"TA", + "LAST_SUP_PIDM":"7" + }, + ] localStudents = [ - { - "ID": "B00841417", - "PIDM": "2", - "FIRST_NAME": "Alex", - "LAST_NAME": "Bryant", - "CLASS_LEVEL": "Senior", - "ACADEMIC_FOCUS": "Computer Science", - "MAJOR": "Computer Science", - "PROBATION": "0", - "ADVISOR": "Scott Heggen", - "STU_EMAIL": "bryantal@berea.edu", - "STU_CPO": "212", - "LAST_POSN": "Student Manager", - "LAST_SUP_PIDM": "7" - }, -] + { + "ID":"B00841417", + "PIDM":"2", + "FIRST_NAME":"Alex", + "LAST_NAME":"Bryant", + "CLASS_LEVEL":"Senior", + "ACADEMIC_FOCUS":"Computer Science", + "MAJOR":"Computer Science", + "PROBATION":"0", + "ADVISOR":"Scott Heggen", + "STU_EMAIL":"bryantal@berea.edu", + "STU_CPO":"212", + "LAST_POSN":"Student Manager", + "LAST_SUP_PIDM":"7" + }, + ] tracyStudents = [ - { - "ID": "B00785329", - "PIDM": "4", - "FIRST_NAME": "Kat", - "LAST_NAME": "Adams", - "CLASS_LEVEL": "Senior", - "ACADEMIC_FOCUS": "Computer Science", - "MAJOR": "Computer Science", - "PROBATION": "0", - "ADVISOR": "Scott Heggen", - "STU_EMAIL": "adamskg@berea.edu", - "STU_CPO": "420", - "LAST_POSN": "TA", - "LAST_SUP_PIDM": "7" - }, - { - "ID": "B00888329", - "PIDM": "7", - "FIRST_NAME": "Jeremiah", - "LAST_NAME": "Bullfrog", - "CLASS_LEVEL": "Senior", - "ACADEMIC_FOCUS": "Computer Science", - "MAJOR": "Computer Science", - "PROBATION": "0", - "ADVISOR": "Scott Heggen", - "STU_EMAIL": "bullfrogj@berea.edu", - "STU_CPO": "420", - "LAST_POSN": "TA", - "LAST_SUP_PIDM": "7" - }, - { - "ID": "B00751360", - "PIDM": "90", - "FIRST_NAME": "Tyler", - "LAST_NAME": "Parton", - "CLASS_LEVEL": "Senior", - "ACADEMIC_FOCUS": "Computer Science", - "MAJOR": "Computer Science", - "PROBATION": "0", - "ADVISOR": "Scott Heggen", - "STU_EMAIL": "partont@berea.edu", - "STU_CPO": "420", - "LAST_POSN": "TA", - "LAST_SUP_PIDM": "7" - } + { + "ID":"B00785329", + "PIDM":"4", + "FIRST_NAME":"Kat", + "LAST_NAME":"Adams", + "CLASS_LEVEL":"Senior", + "ACADEMIC_FOCUS":"Computer Science", + "MAJOR":"Computer Science", + "PROBATION":"0", + "ADVISOR":"Scott Heggen", + "STU_EMAIL":"adamskg@berea.edu", + "STU_CPO":"420", + "LAST_POSN":"TA", + "LAST_SUP_PIDM":"7" + }, + { + "ID":"B00888329", + "PIDM":"7", + "FIRST_NAME":"Jeremiah", + "LAST_NAME":"Bullfrog", + "CLASS_LEVEL":"Senior", + "ACADEMIC_FOCUS":"Computer Science", + "MAJOR":"Computer Science", + "PROBATION":"0", + "ADVISOR":"Scott Heggen", + "STU_EMAIL":"bullfrogj@berea.edu", + "STU_CPO":"420", + "LAST_POSN":"TA", + "LAST_SUP_PIDM":"7" + }, + { + "ID":"B00751360", + "PIDM":"90", + "FIRST_NAME":"Tyler", + "LAST_NAME":"Parton", + "CLASS_LEVEL":"Senior", + "ACADEMIC_FOCUS":"Computer Science", + "MAJOR":"Computer Science", + "PROBATION":"0", + "ADVISOR":"Scott Heggen", + "STU_EMAIL":"partont@berea.edu", + "STU_CPO":"420", + "LAST_POSN":"TA", + "LAST_SUP_PIDM":"7" + } ] # Add students to Tracy db @@ -175,86 +174,86 @@ # Positions (TRACY) ############################# positions = [ - { - "POSN_CODE": "S61407", - "POSN_TITLE": "Student Programmer", - "WLS": "1", - "ORG": "2114", - "ACCOUNT": "6740", - "DEPT_NAME": "Computer Science" - }, - { - "POSN_CODE": "S61408", - "POSN_TITLE": "Research Associate", - "WLS": "5", - "ORG": "2114", - "ACCOUNT": "6740", - "DEPT_NAME": "Computer Science" - }, - { - "POSN_CODE": "S61419", - "POSN_TITLE": "Teaching Associate", - "WLS": "3", - "ORG": "2114", - "ACCOUNT": "6740", - "DEPT_NAME": "Computer Science" - }, - { - "POSN_CODE": "S61420", - "POSN_TITLE": "Teaching Associate", - "WLS": "5", - "ORG": "2147", - "ACCOUNT": "6740", - "DEPT_NAME": "Technology and Applied Design" - }, - { - "POSN_CODE": "S61421", - "POSN_TITLE": "TA", - "WLS": "6", - "ORG": "2114", - "ACCOUNT": "6740", - "DEPT_NAME": "Computer Science" - }, - { - "POSN_CODE": "S61427", - "POSN_TITLE": "Teaching Associate", - "WLS": "2", - "ORG": "2150", - "ACCOUNT": "6740", - "DEPT_NAME": "Mathematics" - }, - { - "POSN_CODE": "S61430", - "POSN_TITLE": "Teaching Associate", - "WLS": "5", - "ORG": "2107", - "ACCOUNT": "6740", - "DEPT_NAME": "Biology" - }, - { - "POSN_CODE": "S61443", - "POSN_TITLE": "Lab Assistant", - "WLS": "6", - "ORG": "2107", - "ACCOUNT": "6740", - "DEPT_NAME": "Biology" - }, - { - "POSN_CODE": "S12345", - "POSN_TITLE": "DUMMY POSITION", - "WLS": "3", - "ORG": "2114", - "ACCOUNT": "6740", - "DEPT_NAME": "Computer Science" - }, - { - "POSN_CODE": "S61409", - "POSN_TITLE": "Labor Workers", - "WLS": "1", - "ORG": "4022", - "ACCOUNT": "6740", - "DEPT_NAME": "Labor Department" - } + { + "POSN_CODE": "S61407", + "POSN_TITLE": "Student Programmer", + "WLS": "1", + "ORG" : "2114", + "ACCOUNT":"6740", + "DEPT_NAME":"Computer Science" + }, + { + "POSN_CODE": "S61408", + "POSN_TITLE": "Research Associate", + "WLS": "5", + "ORG" : "2114", + "ACCOUNT":"6740", + "DEPT_NAME":"Computer Science" + }, + { + "POSN_CODE": "S61419", + "POSN_TITLE": "Teaching Associate", + "WLS": "3", + "ORG" : "2114", + "ACCOUNT":"6740", + "DEPT_NAME":"Computer Science" + }, + { + "POSN_CODE": "S61420", + "POSN_TITLE": "Teaching Associate", + "WLS": "5", + "ORG" : "2147", + "ACCOUNT":"6740", + "DEPT_NAME":"Technology and Applied Design" + }, + { + "POSN_CODE": "S61421", + "POSN_TITLE": "TA", + "WLS": "6", + "ORG" : "2114", + "ACCOUNT":"6740", + "DEPT_NAME":"Computer Science" + }, + { + "POSN_CODE": "S61427", + "POSN_TITLE": "Teaching Associate", + "WLS": "2", + "ORG" : "2150", + "ACCOUNT":"6740", + "DEPT_NAME":"Mathematics" + }, + { + "POSN_CODE": "S61430", + "POSN_TITLE": "Teaching Associate", + "WLS": "5", + "ORG" : "2107", + "ACCOUNT":"6740", + "DEPT_NAME":"Biology" + }, + { + "POSN_CODE": "S61443", + "POSN_TITLE": "Lab Assistant", + "WLS": "6", + "ORG" : "2107", + "ACCOUNT":"6740", + "DEPT_NAME":"Biology" + }, + { + "POSN_CODE": "S12345", + "POSN_TITLE": "DUMMY POSITION", + "WLS": "3", + "ORG" : "2114", + "ACCOUNT":"6740", + "DEPT_NAME":"Computer Science" + }, + { + "POSN_CODE": "S61409", + "POSN_TITLE": "Labor Workers", + "WLS": "1", + "ORG" : "4022", + "ACCOUNT":"6740", + "DEPT_NAME":"Labor Department" + } ] # Add to Tracy db @@ -270,90 +269,90 @@ ############################# staffs = [ - { - "ID": "B12361006", - "PIDM": 1, - "FIRST_NAME": "Scott", - "LAST_NAME": "Heggen", - "EMAIL": "heggens@berea.edu", - "CPO": "6300", - "ORG": "2114", - "DEPT_NAME": "Computer Science" - }, - { - "ID": "B00769499", - "PIDM": 28, - "FIRST_NAME": "Madina", - "LAST_NAME": "Solijonova", - "EMAIL": "solijonovam@berea.edu", - "CPO": "6300", - "ORG": "2114", - "DEPT_NAME": "Computer Science" - }, - { - "ID": "B12365892", - "PIDM": 2, - "FIRST_NAME": "Jan", - "LAST_NAME": "Pearce", - "EMAIL": "pearcej@berea.edu", - "CPO": "6301", - "ORG": "2114", - "DEPT_NAME": "Computer Science" - }, - { - "ID": "B12365893", - "PIDM": 5, - "FIRST_NAME": "Jasmine", - "LAST_NAME": "Jones", - "EMAIL": "jonesj@berea.edu", - "CPO": "6301", - "ORG": "2114", - "DEPT_NAME": "Computer Science" - }, - { - "ID": "B00763721", - "PIDM": 6, - "FIRST_NAME": "Brian", - "LAST_NAME": "Ramsay", - "EMAIL": "ramsayb2@berea.edu", - "CPO": "6305", - "ORG": "2114", - "DEPT_NAME": "Computer Science" - }, - { - "ID": "B00841417", - "PIDM": 7, - "FIRST_NAME": "Alex", - "LAST_NAME": "Bryant", - "EMAIL": "bryantal@berea.edu", - "CPO": "420", - "ORG": "2114", - "DEPT_NAME": "Computer Science" - } -] + { + "ID": "B12361006", + "PIDM":1, + "FIRST_NAME":"Scott", + "LAST_NAME" : "Heggen", + "EMAIL" :"heggens@berea.edu", + "CPO":"6300", + "ORG":"2114", + "DEPT_NAME": "Computer Science" + }, + { + "ID": "B00769499", + "PIDM":28, + "FIRST_NAME":"Madina", + "LAST_NAME" : "Solijonova", + "EMAIL" :"solijonovam@berea.edu", + "CPO":"6300", + "ORG":"2114", + "DEPT_NAME": "Computer Science" + }, + { + "ID": "B12365892", + "PIDM":2, + "FIRST_NAME":"Jan", + "LAST_NAME" : "Pearce", + "EMAIL" :"pearcej@berea.edu", + "CPO":"6301", + "ORG":"2114", + "DEPT_NAME": "Computer Science" + }, + { + "ID": "B12365893", + "PIDM":5, + "FIRST_NAME":"Jasmine", + "LAST_NAME" : "Jones", + "EMAIL" :"jonesj@berea.edu", + "CPO":"6301", + "ORG":"2114", + "DEPT_NAME": "Computer Science" + }, + { + "ID": "B00763721", + "PIDM":6, + "FIRST_NAME":"Brian", + "LAST_NAME" : "Ramsay", + "EMAIL" :"ramsayb2@berea.edu", + "CPO":"6305", + "ORG":"2114", + "DEPT_NAME": "Computer Science" + }, + { + "ID": "B00841417", + "PIDM":7, + "FIRST_NAME":"Alex", + "LAST_NAME" : "Bryant", + "EMAIL" :"bryantal@berea.edu", + "CPO":"420", + "ORG":"2114", + "DEPT_NAME": "Computer Science" + } + ] non_supervisor_staffs = [ - { - "ID": "B1236237", - "PIDM": 4, - "FIRST_NAME": "Megan", - "LAST_NAME": "Hoffman", - "EMAIL": "hoffmanm@berea.edu", - "CPO": "6303", - "ORG": "2107", - "DEPT_NAME": "Biology" - }, - { - "ID": "B1236236", - "PIDM": 3, - "FIRST_NAME": "Mario", - "LAST_NAME": "Nakazawa", - "EMAIL": "nakazawam@berea.edu", - "CPO": "6302", - "ORG": "2150", - "DEPT_NAME": "Mathematics" - } -] + { + "ID": "B1236237", + "PIDM":4, + "FIRST_NAME":"Megan", + "LAST_NAME" : "Hoffman", + "EMAIL" :"hoffmanm@berea.edu", + "CPO":"6303", + "ORG":"2107", + "DEPT_NAME": "Biology" + }, + { + "ID": "B1236236", + "PIDM":3, + "FIRST_NAME":"Mario", + "LAST_NAME" : "Nakazawa", + "EMAIL" :"nakazawam@berea.edu", + "CPO":"6302", + "ORG":"2150", + "DEPT_NAME": "Mathematics" + } + ] # Add to Tracy db with app.app_context(): @@ -377,125 +376,126 @@ # Users ############################# users = [ - { + { "student": None, "supervisor": "B12361006", "username": "heggens", "isLaborAdmin": 1, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": None, "supervisor": "B12365892", "username": "pearcej", "isLaborAdmin": None, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": None, "supervisor": "B12365893", "username": "jonesj", "isLaborAdmin": None, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": None, "supervisor": "B00763721", "username": "ramsayb2", "isLaborAdmin": 1, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": "B00730361", "supervisor": None, "username": "jamalie", "isLaborAdmin": None, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": "B00734292", "supervisor": None, "username": "cruzg", "isLaborAdmin": None, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": "B00791326", "supervisor": None, "username": "makindeo", "isLaborAdmin": None, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": "B00841417", "supervisor": "B00841417", "username": "bryantal", "isLaborAdmin": None, "isFinancialAidAdmin": None, "isSaasAdmin": None - }, - { + }, + { "student": "B12345773", "supervisor": None, "username": "test1", "isLaborAdmin": None, "isFinancialAidAdmin": None, "isSaasAdmin": None - } -] + } + ] User.insert_many(users).on_conflict_replace().execute() print(" * users added") + ############################# # Department ############################# departments = [ - { - "departmentID": 1, - "DEPT_NAME": "Computer Science", - "ACCOUNT": "6740", - "ORG": "2114", - "departmentCompliance": 1 - }, - { - "departmentID": 2, - "DEPT_NAME": "Technology and Applied Design", - "ACCOUNT": "6740", - "ORG": "2147", - "departmentCompliance": 1 - }, - { - "departmentID": 3, - "DEPT_NAME": "Mathematics", - "ACCOUNT": "6740", - "ORG": "2150", - "departmentCompliance": 1 - }, - { - "departmentID": 4, - "DEPT_NAME": "Biology", - "ACCOUNT": "6740", - "ORG": "2107", - "departmentCompliance": 1 - }, - { - "departmentID": 5, - "DEPT_NAME": "Labor Department", - "ACCOUNT": "6740", - "ORG": "4022", - "departmentCompliance": 1, - "isActive": 1 - } - -] + { + "departmentID":1, + "DEPT_NAME": "Computer Science", + "ACCOUNT": "6740", + "ORG": "2114", + "departmentCompliance": 1 + }, + { + "departmentID":2, + "DEPT_NAME": "Technology and Applied Design", + "ACCOUNT": "6740", + "ORG": "2147", + "departmentCompliance": 1 + }, + { + "departmentID":3, + "DEPT_NAME": "Mathematics", + "ACCOUNT": "6740", + "ORG": "2150", + "departmentCompliance": 1 + }, + { + "departmentID":4, + "DEPT_NAME": "Biology", + "ACCOUNT": "6740", + "ORG": "2107", + "departmentCompliance": 1 + }, + { + "departmentID":5, + "DEPT_NAME": "Labor Department", + "ACCOUNT": "6740", + "ORG": "4022", + "departmentCompliance": 1, + "isActive": 1 + } + + ] Department.insert_many(departments).on_conflict_replace().execute() print(" * departments added") @@ -536,89 +536,76 @@ today = datetime.now() current_year = today.year - (today.month < 8) LaborStatusForm.insert([{ - "laborStatusFormID": 2, - "termCode_id": f"{current_year}00", - "studentName": "Alex Bryant", - "studentSupervisee_id": "B00841417", - "supervisor_id": "B12361006", - "department_id": 1, - "jobType": "Primary", - "WLS": 1, - "POSN_TITLE": "Student Programmer", - "POSN_CODE": "S61407", - "weeklyHours": 10, - "startDate": f"{current_year}-04-01", - "endDate": f"{current_year}-09-01" -}]).on_conflict_replace().execute() + "laborStatusFormID": 2, + "termCode_id": f"{current_year}00", + "studentName": "Alex Bryant", + "studentSupervisee_id": "B00841417", + "supervisor_id": "B12361006", + "department_id": 1, + "jobType": "Primary", + "WLS": 1, + "POSN_TITLE": "Student Programmer", + "POSN_CODE": "S61407", + "weeklyHours": 10, + "startDate": f"{current_year}-04-01", + "endDate": f"{current_year}-09-01" + }]).on_conflict_replace().execute() FormHistory.insert([{ - "formHistoryID": 2, - "formID_id": "2", - "historyType_id": "Labor Status Form", - "createdBy_id": 1, - "createdDate": f"{current_year}-04-14", - "status_id": "Pending" -}]).on_conflict_replace().execute() + "formHistoryID": 2, + "formID_id": "2", + "historyType_id": "Labor Status Form", + "createdBy_id": 1, + "createdDate": f"{current_year}-04-14", + "status_id": "Pending" + }]).on_conflict_replace().execute() LaborStatusForm.insert([{ - "laborStatusFormID": 3, - "termCode_id": f"{current_year}00", - "studentName": "Test Taker", - "studentSupervisee_id": "B12345773", - "supervisor_id": "B12361006", - "department_id": 5, - "jobType": "Primary", - "WLS": 1, - "POSN_TITLE": "Labor Workers", - "POSN_CODE": "S61409", - "weeklyHours": 10, - "startDate": f"{current_year}-04-01", - "endDate": "2025-09-01" -}]).on_conflict_replace().execute() + "laborStatusFormID": 3, + "termCode_id": f"{current_year}00", + "studentName": "Test Taker", + "studentSupervisee_id": "B12345773", + "supervisor_id": "B12361006", + "department_id": 5, + "jobType": "Primary", + "WLS": 1, + "POSN_TITLE": "Labor Workers", + "POSN_CODE": "S61409", + "weeklyHours": 10, + "startDate": f"{current_year}-04-01", + "endDate": "2025-09-01" + }]).on_conflict_replace().execute() FormHistory.insert([{ - "formHistoryID": 3, - "formID_id": "3", - "historyType_id": "Labor Status Form", - "createdBy_id": 1, - "createdDate": f"{current_year}-04-14", - "status_id": "Approved" -}]).on_conflict_replace().execute() + "formHistoryID": 3, + "formID_id": "3", + "historyType_id": "Labor Status Form", + "createdBy_id": 1, + "createdDate": f"{current_year}-04-14", + "status_id": "Approved" + }]).on_conflict_replace().execute() + ############################# # admin Notes ############################# notes = [ - { - "noteHistoryID": 1, - "formID_id": 2, - "date": "2020-01-01", - "createdBy": 1, - "notesContents": "This is the first note", - "noteType": "Supervisor Note" - }, - { - "noteHistoryID": 2, - "formID_id": 2, - "date": "2020-02-01", - "createdBy": 1, - "notesContents": "This is the second note", - "noteType": "Labor Note" - }, -] + { + "noteHistoryID": 1, + "formID_id": 2, + "date":"2020-01-01", + "createdBy" : 1, + "notesContents": "This is the first note", + "noteType" : "Supervisor Note" + }, + { + "noteHistoryID": 2, + "formID_id": 2, + "date":"2020-02-01", + "createdBy" : 1, + "notesContents": "This is the second note", + "noteType" : "Labor Note" + }, + ] Notes.insert_many(notes).on_conflict_replace().execute() print(" * laborOfficeNotes added") - - -############################# -# Creates an emailTracker -############################# -EmailTracker.insert([{ - "emailTrackerID": 1, - "formID": 2, - "date": "2026-06-18", - "recipient": "test guy", - "templateID": 4, - "recipientEmails": "coolguy@email.com", - "body": "super secret text that you cant read" -}]).on_conflict_replace().execute() From f0b08d5586e8c482836c1c86c1174e02f429fd10 Mon Sep 17 00:00:00 2001 From: zhytkovd Date: Mon, 22 Jun 2026 15:09:54 +0000 Subject: [PATCH 6/9] added redactions to data-scrub for emailTracker. Added email demo data to test --- database/data-scrub.sql | 4 ++++ database/demo_data.py | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/database/data-scrub.sql b/database/data-scrub.sql index af3c3125d..719cfb21e 100644 --- a/database/data-scrub.sql +++ b/database/data-scrub.sql @@ -12,3 +12,7 @@ UPDATE laborstatusform set laborDepartmentNotes=CASE WHEN LENGTH(laborDepartment UPDATE notes set notesContents='Notes are not visible except in the production environment' UPDATE studentlaborevaluation SET attendance_comment=CASE WHEN LENGTH(attendance_comment)>0 THEN '' ELSE '' END, accountability_comment=CASE WHEN LENGTH(accountability_comment)>0 THEN '' ELSE '' END, teamwork_comment=CASE WHEN LENGTH(teamwork_comment)>0 THEN '' ELSE '' END, initiative_comment=CASE WHEN LENGTH(initiative_comment)>0 THEN '' ELSE '' END, respect_comment=CASE WHEN LENGTH(respect_comment)>0 THEN '' ELSE '' END, learning_comment=CASE WHEN LENGTH(learning_comment)>0 THEN '' ELSE '' END, jobSpecific_comment=CASE WHEN LENGTH(jobSpecific_comment)>0 THEN '' ELSE '' END, transcript_comment=CASE WHEN LENGTH(transcript_comment)>0 THEN '' ELSE '' END + +-- removes parts of the email tracker +UPDATE emailtracker set recipientEmails=CASE WHEN LENGTH(recipientEmails)>0 THEN '' ELSE '' END +UPDATE emailtracker set body=CASE WHEN LENGTH(body)>0 THEN '' ELSE '' END \ No newline at end of file diff --git a/database/demo_data.py b/database/demo_data.py index 0557c9361..8f5049842 100644 --- a/database/demo_data.py +++ b/database/demo_data.py @@ -17,6 +17,7 @@ from app.models.laborStatusForm import LaborStatusForm from app.models.formHistory import FormHistory from app.models.notes import Notes +from app.models.emailTracker import EmailTracker print("Inserting data for demo and testing purposes") @@ -609,3 +610,17 @@ ] Notes.insert_many(notes).on_conflict_replace().execute() print(" * laborOfficeNotes added") + + +############################# +# Creates an emailTracker +############################# +EmailTracker.insert([{ + "emailTrackerID": 1, + "formID": 2, + "date": "2026-06-18", + "recipient": "test guy", + "templateID": 4, + "recipientEmails": "coolguy@email.com", + "body": "super secret text that you cant read" + }]).on_conflict_replace().execute() \ No newline at end of file From fed67dc920d990118c68592c611492e2244d4433 Mon Sep 17 00:00:00 2001 From: fritzj2 Date: Mon, 22 Jun 2026 18:07:11 +0000 Subject: [PATCH 7/9] changed how the test data reads to account for more data --- database/demo_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/demo_data.py b/database/demo_data.py index 8f5049842..9f36d65ca 100644 --- a/database/demo_data.py +++ b/database/demo_data.py @@ -616,7 +616,7 @@ # Creates an emailTracker ############################# EmailTracker.insert([{ - "emailTrackerID": 1, + "emailTrackerID": 1000000, "formID": 2, "date": "2026-06-18", "recipient": "test guy", From 5f38bc7fe43ca36ed2bc86f7da6d68c89d8af5fd Mon Sep 17 00:00:00 2001 From: fritzj2 Date: Wed, 1 Jul 2026 15:23:52 +0000 Subject: [PATCH 8/9] fixed the template in email tracker, rm subject from email handler, fixed wording in demo_data.py --- app/logic/emailHandler.py | 1 - app/models/emailTracker.py | 2 +- database/demo_data.py | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/logic/emailHandler.py b/app/logic/emailHandler.py index e7933206a..3a32791e1 100644 --- a/app/logic/emailHandler.py +++ b/app/logic/emailHandler.py @@ -382,7 +382,6 @@ def sendEmail(self, template, sendTo): formID = self.laborStatusForm.laborStatusFormID, date = datetime.today().strftime('%Y-%m-%d'), recipient = recipient, - subject = template.subject, templateID = template.emailTemplateID, recipientEmails = ",".join(message.recipients), body = formTemplate, diff --git a/app/models/emailTracker.py b/app/models/emailTracker.py index c0b6ace7a..a3fb42b8e 100644 --- a/app/models/emailTracker.py +++ b/app/models/emailTracker.py @@ -7,7 +7,7 @@ class EmailTracker(baseModel): formID = ForeignKeyField(LaborStatusForm) # foreign key to lsf date = DateField() recipient = CharField() - templateID = ForeignKeyField(EmailTemplate) # foreign key to email template + template = ForeignKeyField(EmailTemplate) # foreign key to email template recipientEmails = TextField() body = TextField() diff --git a/database/demo_data.py b/database/demo_data.py index 9f36d65ca..6c029e338 100644 --- a/database/demo_data.py +++ b/database/demo_data.py @@ -619,8 +619,8 @@ "emailTrackerID": 1000000, "formID": 2, "date": "2026-06-18", - "recipient": "test guy", - "templateID": 4, - "recipientEmails": "coolguy@email.com", + "recipient": "Julius Fritz", + "template": 4, + "recipientEmails": "fritzj2@berea.edu", "body": "super secret text that you cant read" }]).on_conflict_replace().execute() \ No newline at end of file From 06eb7e58c8b83a219fa465024da9d6ce82321dba Mon Sep 17 00:00:00 2001 From: fritzj2 Date: Wed, 1 Jul 2026 15:28:34 +0000 Subject: [PATCH 9/9] changed the 'templateID' wording to 'template' to better reflect the emailTracker language --- app/logic/emailHandler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/logic/emailHandler.py b/app/logic/emailHandler.py index 3a32791e1..d5fbf0e62 100644 --- a/app/logic/emailHandler.py +++ b/app/logic/emailHandler.py @@ -382,7 +382,7 @@ def sendEmail(self, template, sendTo): formID = self.laborStatusForm.laborStatusFormID, date = datetime.today().strftime('%Y-%m-%d'), recipient = recipient, - templateID = template.emailTemplateID, + template = template.emailTemplateID, recipientEmails = ",".join(message.recipients), body = formTemplate, )