Source code for uw.local.teaching.bin.ta_eval_approve_reminder

"""TA evaluation approval reminder.

Python process to remind course coordinators of the need to approve their TA
evaluations.  Sends emails to coordinators of all offerings with evaluations
that have not approved their evaluations.
"""

import argparse

from uw.sql.wrap import open_psycopg2_db_service_cursor

from uw.local.termtools import fromCode

from ...outgoing.make_mail import mailout
from ...util.mail import odyssey_email

from ..db.exam_print import message_to_course_staff

[docs]def main (): parser = argparse.ArgumentParser () parser.add_argument ('--term', required=True, type=int, metavar='term_id') args = parser.parse_args () term = fromCode (args.term) cursor = open_psycopg2_db_service_cursor () offerings = cursor.execute_tuples ("select distinct unit_code, term_id, admin_id, admin_description from ta_position_assignment natural join teaching_admin left join ta_term_unit_admin tua using (unit_code, term_id, admin_id) where tua is null and job_code in ('TA', 'IA', 'CS') and term_id = %(term_id)s order by admin_description", term_id=term.code ()) for offering in offerings: print (offering.admin_description) content_lines = [ 'You are receiving this email because you are recorded as being responsible for %s in %s.' % (offering.admin_description, term.description ()), '', 'Please complete your submission of TA evaluations by logging in to Odyssey and approving your TA evaluation submission:', '', 'https://odyssey.uwaterloo.ca/teaching/term/%s/%s/ta/eval/' % (term.code (), offering.admin_id), '', 'TA evaluations become visible to the students only after they have been approved.', ] content = '\n'.join (content_lines) message = mailout (cursor, odyssey_email, '%s (%s) TA Evaluations' % (offering.admin_description, term.description ()), content) message_to_course_staff (cursor, message, term.code (), offering.admin_id, ['ISC']) message.add_recipient ('Cc', odyssey_email) message.done () cursor.connection.commit ()