Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
8698c84
Added body information to the email tracking table in the database
zhytkovd Jun 18, 2026
a0d3615
made progress towards adding template and recepientEmails
zhytkovd Jun 18, 2026
1af112a
Added recipientEmails, templateID, body and removed subject to the em…
zhytkovd Jun 19, 2026
304c70d
New redactions to data dumps.New data to test redactions. New data co…
zhytkovd Jun 22, 2026
2f2f64b
Revert "New redactions to data dumps.New data to test redactions. New…
zhytkovd Jun 22, 2026
f0b08d5
added redactions to data-scrub for emailTracker. Added email demo dat…
zhytkovd Jun 22, 2026
fed67dc
changed how the test data reads to account for more data
fritzj2 Jun 22, 2026
67c012d
Merge branch 'development' of https://github.com/BCStudentSoftwareDev…
fritzj2 Jun 22, 2026
d6987f1
Merge branch 'development' of https://github.com/BCStudentSoftwareDev…
fritzj2 Jun 22, 2026
678d490
Merge branch 'development' into zhytkovd_fritzj2_#561
MImran2002 Jun 24, 2026
4b018e7
Merge branch 'development' of https://github.com/BCStudentSoftwareDev…
fritzj2 Jul 1, 2026
5f38bc7
fixed the template in email tracker, rm subject from email handler, f…
fritzj2 Jul 1, 2026
06eb7e5
changed the 'templateID' wording to 'template' to better reflect the …
fritzj2 Jul 1, 2026
af468dc
Merge branch 'development' into zhytkovd_fritzj2_#561
MImran2002 Jul 6, 2026
df85c15
Merge branch 'development' into zhytkovd_fritzj2_#561
MImran2002 Jul 9, 2026
6a2c4a0
Merge remote-tracking branch 'origin' into zhytkovd_fritzj2_#561
fritzj2 Aug 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions app/logic/emailHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
Expand All @@ -375,18 +374,18 @@ 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
template = template.emailTemplateID,
recipientEmails = ",".join(message.recipients),
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
Expand Down
9 changes: 7 additions & 2 deletions app/models/emailTracker.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
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()
template = ForeignKeyField(EmailTemplate) # foreign key to email template
recipientEmails = TextField()
body = TextField()


4 changes: 4 additions & 0 deletions database/data-scrub.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<redacted>' ELSE '' END, accountability_comment=CASE WHEN LENGTH(accountability_comment)>0 THEN '<redacted>' ELSE '' END, teamwork_comment=CASE WHEN LENGTH(teamwork_comment)>0 THEN '<redacted>' ELSE '' END, initiative_comment=CASE WHEN LENGTH(initiative_comment)>0 THEN '<redacted>' ELSE '' END, respect_comment=CASE WHEN LENGTH(respect_comment)>0 THEN '<redacted>' ELSE '' END, learning_comment=CASE WHEN LENGTH(learning_comment)>0 THEN '<redacted>' ELSE '' END, jobSpecific_comment=CASE WHEN LENGTH(jobSpecific_comment)>0 THEN '<redacted>' ELSE '' END, transcript_comment=CASE WHEN LENGTH(transcript_comment)>0 THEN '<redacted>' ELSE '' END

-- removes parts of the email tracker
UPDATE emailtracker set recipientEmails=CASE WHEN LENGTH(recipientEmails)>0 THEN '<redacted>' ELSE '' END
UPDATE emailtracker set body=CASE WHEN LENGTH(body)>0 THEN '<redacted>' ELSE '' END
15 changes: 15 additions & 0 deletions database/demo_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -609,3 +610,17 @@
]
Notes.insert_many(notes).on_conflict_replace().execute()
print(" * laborOfficeNotes added")


#############################
# Creates an emailTracker
#############################
EmailTracker.insert([{
"emailTrackerID": 1000000,
"formID": 2,
"date": "2026-06-18",
"recipient": "Julius Fritz",
"template": 4,
"recipientEmails": "fritzj2@berea.edu",
"body": "super secret text that you cant read"
Comment thread
MImran2002 marked this conversation as resolved.
}]).on_conflict_replace().execute()