doorcontrol: Add unique member count to "busiest..." reports
All checks were successful
Ruff / ruff (push) Successful in 22s
All checks were successful
Ruff / ruff (push) Successful in 22s
This commit is contained in:
parent
02080206c6
commit
d8b275fe74
@ -302,6 +302,7 @@ class DetailByDay(BaseAccessReport):
|
|||||||
class BusiestDayOfWeekTable(tables.Table):
|
class BusiestDayOfWeekTable(tables.Table):
|
||||||
timestamp__week_day = tables.Column("Week Day")
|
timestamp__week_day = tables.Column("Week Day")
|
||||||
events = tables.Column()
|
events = tables.Column()
|
||||||
|
members = tables.Column()
|
||||||
|
|
||||||
def render_timestamp__week_day(self, value):
|
def render_timestamp__week_day(self, value):
|
||||||
return calendar.day_name[(value - 2) % 7]
|
return calendar.day_name[(value - 2) % 7]
|
||||||
@ -317,14 +318,18 @@ class BusiestDayOfWeek(BaseAccessReport):
|
|||||||
return (
|
return (
|
||||||
super()
|
super()
|
||||||
.get_table_data()
|
.get_table_data()
|
||||||
|
.with_member_id()
|
||||||
.values("timestamp__week_day")
|
.values("timestamp__week_day")
|
||||||
.annotate(events=Count("timestamp"))
|
.annotate(
|
||||||
|
events=Count("timestamp"), members=Count("member_id", distinct=True)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class BusiestTimeOfDayTable(tables.Table):
|
class BusiestTimeOfDayTable(tables.Table):
|
||||||
timestamp__hour = tables.TemplateColumn("{{ value }}:00", verbose_name="Hour")
|
timestamp__hour = tables.TemplateColumn("{{ value }}:00", verbose_name="Hour")
|
||||||
events = tables.Column()
|
events = tables.Column()
|
||||||
|
members = tables.Column()
|
||||||
|
|
||||||
|
|
||||||
@register_report
|
@register_report
|
||||||
@ -337,6 +342,9 @@ class BusiestTimeOfDay(BaseAccessReport):
|
|||||||
return (
|
return (
|
||||||
super()
|
super()
|
||||||
.get_table_data()
|
.get_table_data()
|
||||||
|
.with_member_id()
|
||||||
.values("timestamp__hour")
|
.values("timestamp__hour")
|
||||||
.annotate(events=Count("timestamp"))
|
.annotate(
|
||||||
|
events=Count("timestamp"), members=Count("member_id", distinct=True)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user