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

"""Termly scheduling request reminder for course coordinators.
"""

import argparse
from datetime import timedelta

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

from ..db.exam_print import message_to_course_staff

from ..webui.ui import format_date_helpful

[docs]def main (): parser = argparse.ArgumentParser () parser.add_argument ('--admin', action='append', type=int, metavar='admin_id') args = parser.parse_args () # If no admins specified, use root admin with admin_id = 20000 admins = set (args.admin) if args.admin else {20000} cursor = open_psycopg2_db_service_cursor () term = fromCode (cursor.execute_required_value ("select uw_term_from_time (current_date + '2 months'::interval)")) courses = cursor.execute_tuples ("select term_id, admin_id, admin_description from teaching_admin_term_exam_schedule_request where term_id = %(term_id)s and outer_admin_id = any (%(admins)s) and quest_enrol_limit is not null and scheduling_submitted is null and isc_person_ids is not null and no_exam is not true order by admin_description", term_id=term.code (), admins=list (admins)) day = timedelta (days=1) course_deadline, examrep_deadline = cursor.execute_required_tuple ("select min (schedule_course_deadline) as c, min (schedule_examrep_deadline) as e from teaching_admin_term_exam_scheduler where term_id = %(term_id)s", term_id=term.code ()) print ('Sending %d emails.' % len (courses)) for course in courses: print (course.admin_description) content_lines = [ f'You are receiving this email because you are recorded as the person responsible for {course.admin_description} in {term.description ()}.', '', f'Please log in to Odyssey as soon as possible and no later than {format_date_helpful (course_deadline - day)}, to record your final assessment requirements for this course:', '', f'https://odyssey.uwaterloo.ca/teaching/term/{term.code ()}/{course.admin_id}/scheduling', '', 'Please make sure to click the Submit button at the bottom of the form to complete your final exam information submission.', '', 'PLEASE NOTE:', ' * Instructors are encouraged to find alternatives to final exams.', ' * Instructors are required to include exam/assessment details in the course outline.', ' * Students may have conflicts during the assessment period.  Instructors will be responsible for accommodating students with conflicts, as well as those who cannot or are not willing to be proctored online (due to technology restrictions, etc.).', ' * Exam printing requests submitted to the Registrar’s Office must be uploaded via Odyssey or delivered on a flash drive directly to W Print if the exam is created in Markbox and each paper is unique.', ' * If you are choosing to have multiple synchronous times, the Registrar’s Office will provide you with one conflict free time; any other times will be decided by the instructor.', '', 'NEW FOR SPRING 2021 TERM:', ' * Due to student conflicts in the Fall term, the option for the instructor to schedule their own examination for any undergraduate (including combined grad/ugrad) course with a capacity over 30 students has been removed. If there is a final exam, a time will be assigned by the Registrar’s Office. If there is a reason the instructor needs or wants to schedule their own course we can certainly discuss this on a one on one request. An email can be sent to regmstrs@uwaterloo.ca.', ' * Any instructor who has a take home assignment or examination now has the ability to choose this from the list of options and to pick a deadline date. This will replace choosing No Final Examination as in the past.', '', ] content = '\n'.join (content_lines) message = mailout (cursor, ro_email, '%s %s Final Assessment Scheduling' % (term.description (), course.admin_description), content) message_to_course_staff (cursor, message, course.term_id, course.admin_id, ['ISC']) message.done () cursor.connection.commit ()