Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 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
e74d70a
readded the subject field
fritzj2 Sep 10, 2026
a5be360
added support for prod-backup for new rows
fritzj2 Sep 10, 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
18 changes: 9 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,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.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
8 changes: 7 additions & 1 deletion app/models/emailTracker.py
Original file line number Diff line number Diff line change
@@ -1,9 +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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because we are moving away from subject being use, we can likely having it as null=true as an indication of subject is empty

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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subject needed here

"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()
4 changes: 4 additions & 0 deletions database/prod-backup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ INSERT INTO `emailtracker` VALUES (71931,44589,'2024-12-09','Student','Labor Sta
/*!40000 ALTER TABLE `emailtracker` ENABLE KEYS */;
UNLOCK TABLES;

ALTER TABLE `emailtracker` ADD `template_id` int NULL;
ALTER TABLE `emailtracker` ADD `recipientEmails` varchar(255) NULL DEFAULT '';
ALTER TABLE `emailtracker` ADD `body` varchar(255) NULL DEFAULT '';

--
-- Table structure for table `formhistory`
--
Expand Down