From the ticket and the ticket log that has just been created above, we determine the email, name and contact for the receiver
Update for the ticket log (update the receiver info)
Get the student assignment for this ticket (based on the ticket id).
If there is no assignment → this is submitted as an assignment
Check if this is submitted by a student or not?
If so → Run the submit assignment flow by email (based on the ticket log)
If no → Update the ticket to NULL type (Invalid ticket)
If there is an assignment, we will check if this is a student re-submits assignment or the tutor giving feedback to the admin (other cases cannot be controlled by workflow engine ticket)
If this is a re-submitting assignment by a student → Run the re-submit assignment flow by email (based on the ticket log)
If this is feedback by the tutor → Run the feedback returned by tutor flow by email (based on the ticket log)
Generate:
The email subject with the format: [WorkflowTag #TicketId-TicketLogId] Subject
The attachments
Finally, create an email queue for the ticket log (this email queue will be sent via email sending background task)