diff --git a/coldcall_lti/instructor.py b/coldcall_lti/instructor.py index f035fc3..2dd763d 100644 --- a/coldcall_lti/instructor.py +++ b/coldcall_lti/instructor.py @@ -92,6 +92,10 @@ def home(): db = get_db() course = current_course() today = datetime.date.today() + # The working date: everything on the page targets it. Defaults to + # today, but e.g. printing tomorrow's list a day early just means + # picking tomorrow here. + day = _parse_date(request.args.get("date")) recent_days = db.execute( select( @@ -105,16 +109,19 @@ def home(): .limit(10) ).all() - today_calls = calls.calls_for_day(db, course.id, today) - context = _day_context(db, course, today) + day_calls = calls.calls_for_day(db, course.id, day) + context = _day_context(db, course, day) context.update( recent_days=recent_days, today=today, - has_pending_today=any( - c.status == STATUS_PENDING for c in today_calls + upcoming_class_days=[ + d.date for d in class_days(db, course.id, start=today) + ][:4], + has_pending=any( + c.status == STATUS_PENDING for c in day_calls ), - resolved_today=sum( - 1 for c in today_calls if c.status != STATUS_PENDING + resolved=sum( + 1 for c in day_calls if c.status != STATUS_PENDING ), ) return render_template("instructor_home.html", **context) diff --git a/coldcall_lti/templates/instructor_home.html b/coldcall_lti/templates/instructor_home.html index 9509c9d..c62c478 100644 --- a/coldcall_lti/templates/instructor_home.html +++ b/coldcall_lti/templates/instructor_home.html @@ -4,12 +4,30 @@
{{ roster_count }} active students on the roster; - {{ present_count }} available today ({{ optout_count }} opted out). + {{ present_count }} available on {{ day.isoformat() }} + ({{ optout_count }} opted out).
+ +- Live cold call · - Today's calls · + Live cold call · + Calls for {{ day.isoformat() }} · Report · Grades · Schedule · @@ -23,22 +41,22 @@
- - View today's list + + View the list for {{ day.isoformat() }}
{% endif %} @@ -46,14 +64,14 @@| Date | Calls | Answered | ||
|---|---|---|---|---|
| {{ day.isoformat() }} | +{{ d.isoformat() }} | {{ total }} | {{ answered or 0 }} | - edit · - print + edit · + print |