Commit 92c54daf authored by alan's avatar alan
Browse files

added stats

parent 637da91c
"""
Generate and email status reports
Alan Marchiori (c) 2022
"""
import config
# pull version from labtool
from lt import labtool_version
config.labtool_version = labtool_version
import courses
from utils.mailer import send_email
from labmon import show_course_summary
import io
from contextlib import redirect_stdout
from datetime import datetime
dt = datetime.now().isoformat()
#print(str(dt)[:19])
email_to = set()
# course summary prints to stdout, so capture the output
with io.StringIO() as buf, redirect_stdout(buf), config.UserConfig() as uc:
for c in [f"CSCI206-S22-{x:2d}" for x in range(60,63)]:
email_to.update(courses.all[c]['tas'])
email_to.update(courses.all[c]['instructors'])
print("="*20 + c + "=" * 20)
#code, out = run(f"python3 labmon.py --course {c}")
show_course_summary(c, user=None, email=None, tblfmt="simple")
msg = buf.getvalue()
email_to = [f"{x}@{config.email_domain}" for x in email_to]
print("Sending email to ", email_to)
subject = f"labtool summary report from {str(dt)[:19]}"
send_email(config.feedback_email_from, email_to,
subject,
body=None,
html=f"<pre>{msg}</pre>")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment