chore: less generic record name
This commit is contained in:
parent
be789d4fcb
commit
232270a506
|
|
@ -16,7 +16,7 @@ class AttendanceSummary(graphene.ObjectType):
|
|||
participants_present = graphene.Int()
|
||||
|
||||
|
||||
class Record(graphene.ObjectType):
|
||||
class PresenceRecord(graphene.ObjectType):
|
||||
course_session_id = graphene.ID()
|
||||
generation = graphene.String()
|
||||
circle_id = graphene.ID()
|
||||
|
|
@ -27,7 +27,7 @@ class Record(graphene.ObjectType):
|
|||
|
||||
|
||||
class AttendanceDayPresences(graphene.ObjectType):
|
||||
records = graphene.List(Record)
|
||||
records = graphene.List(PresenceRecord)
|
||||
summary = graphene.Field(AttendanceSummary)
|
||||
|
||||
|
||||
|
|
@ -63,26 +63,26 @@ def attendance_day_presences(
|
|||
)
|
||||
|
||||
records.append(
|
||||
Record(
|
||||
course_session_id=course_session.id,
|
||||
generation=course_session.generation,
|
||||
circle_id=circle.id,
|
||||
due_date=format_swiss_datetime(attendance_day.due_date.end),
|
||||
participants_present=participants_present,
|
||||
participants_total=participants_total,
|
||||
cockpit_url=url,
|
||||
PresenceRecord(
|
||||
course_session_id=course_session.id, # noqa
|
||||
generation=course_session.generation, # noqa
|
||||
circle_id=circle.id, # noqa
|
||||
due_date=format_swiss_datetime(attendance_day.due_date.end), # noqa
|
||||
participants_present=participants_present, # noqa
|
||||
participants_total=participants_total, # noqa
|
||||
cockpit_url=url, # noqa
|
||||
)
|
||||
)
|
||||
|
||||
summary = AttendanceSummary(
|
||||
days_completed=completed.count(),
|
||||
participants_present=calculate_avg_participation(records),
|
||||
days_completed=completed.count(), # noqa
|
||||
participants_present=calculate_avg_participation(records), # noqa
|
||||
)
|
||||
|
||||
return AttendanceDayPresences(summary=summary, records=records)
|
||||
return AttendanceDayPresences(summary=summary, records=records) # noqa
|
||||
|
||||
|
||||
def calculate_avg_participation(records: List[Record]) -> float:
|
||||
def calculate_avg_participation(records: List[PresenceRecord]) -> float:
|
||||
if not records:
|
||||
return 0.0
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue