Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify individual and program printable teacher schedules #3237

Merged
merged 2 commits into from
Mar 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions esp/esp/program/modules/handlers/teacherpreviewmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def module_properties(cls):
"choosable": 1,
}

def teacherhandout(self, request, tl, one, two, module, extra, prog, template_file='teacherschedules.html'):
def teacherhandout(self, request, tl, one, two, module, extra, prog, template_file='teacherschedule.html'):
# Use the template defined in ProgramPrintables
from esp.program.modules.handlers import ProgramPrintables
context = {'module': self}
Expand All @@ -68,11 +68,16 @@ def teacherhandout(self, request, tl, one, two, module, extra, prog, template_fi
else:
teacher = request.user
scheditems = []
for cls in teacher.getTaughtClasses().filter(parent_program = self.program):
if cls.isAccepted():
for section in cls.sections.all():
scheditems.append({'name': teacher.name(), 'teacher': teacher, 'cls': section})
scheditems.sort()
classes = [cls for cls in teacher.getTaughtSections()
if cls.parent_program == self.program
and cls.meeting_times.all().exists()
and cls.resourceassignment_set.all().exists()
and cls.status > 0]
classes.sort()
for cls in classes:
scheditems.append({'name': teacher.name(),
'teacher': teacher,
'cls' : cls})
context['scheditems'] = scheditems
return render_to_response(pmo.baseDir()+template_file, request, context)
else:
Expand Down