Export num students and attended in class report
This commit is contained in:
parent
c2e566bc30
commit
d8e72a8168
|
@ -8,7 +8,7 @@ from apiserver.api import models
|
||||||
sessions = models.Session.objects.filter(datetime__gte='2021-01-01')
|
sessions = models.Session.objects.filter(datetime__gte='2021-01-01')
|
||||||
|
|
||||||
with open('output.csv', 'w', newline='') as csvfile:
|
with open('output.csv', 'w', newline='') as csvfile:
|
||||||
fields = ['date', 'name', 'num_students']
|
fields = ['date', 'name', 'num_students','attended']
|
||||||
writer = csv.DictWriter(csvfile, fieldnames=fields)
|
writer = csv.DictWriter(csvfile, fieldnames=fields)
|
||||||
|
|
||||||
writer.writeheader()
|
writer.writeheader()
|
||||||
|
@ -17,6 +17,7 @@ with open('output.csv', 'w', newline='') as csvfile:
|
||||||
writer.writerow(dict(
|
writer.writerow(dict(
|
||||||
date=s.datetime.date(),
|
date=s.datetime.date(),
|
||||||
name=s.course.name,
|
name=s.course.name,
|
||||||
num_students=s.students.filter(attendance_status='Attended').count(),
|
num_students=s.students.count(),
|
||||||
|
attended=s.students.filter(attendance_status='Attended').count(),
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user