Skip to content

Commit 3a7125e

Browse files
committed
Group statistics improved, again.
1 parent f7bedff commit 3a7125e

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

pages/admin.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,14 @@ def create_card(self):
122122
month_hours = str(self.stats['month_seconds'] // 3600).split(".")[0]
123123
month_minutes = str((self.stats['month_seconds'] % 3600) // 60).split(".")[0]
124124

125+
last_month_hours = str(self.stats['last_month_seconds'] // 3600).split(".")[0]
126+
last_month_minutes = str((self.stats['last_month_seconds'] % 3600) // 60).split(".")[0]
127+
125128
year_hours = str(self.stats['year_seconds'] // 3600).split(".")[0]
126129
year_minutes = str((self.stats['year_seconds'] % 3600) // 60).split(".")[0]
127130

128131
month_time = f"{month_hours}h {month_minutes}m"
132+
last_month_time = f"{last_month_hours}h {last_month_minutes}m"
129133
year_time = f"{year_hours}h {year_minutes}m"
130134

131135
with ui.card().classes("my-2").style("width: 100%; box-shadow: none; border: 1px solid #e0e0e0; padding: 16px;"):
@@ -147,12 +151,16 @@ def create_card(self):
147151
with ui.row().classes("w-full gap-8"):
148152
with ui.column().style("min-width: 30%;"):
149153
ui.label("This month").classes("font-semibold")
150-
ui.label(f"Total files: {self.stats["month_files"]}").classes("text-sm")
151-
ui.label(f"Total transcription time: {month_time}").classes("text-sm")
154+
ui.label(f"Transcribed files current month: {self.stats["month_files"]}").classes("text-sm")
155+
ui.label(f"Transcription time current month: {month_time}").classes("text-sm")
156+
with ui.column():
157+
ui.label("Last month").classes("font-semibold")
158+
ui.label(f"Transcribed files last month: {self.stats["last_month_files"]}").classes("text-sm")
159+
ui.label(f"Transcription time last month: {last_month_time}m").classes("text-sm")
152160
with ui.column():
153161
ui.label("This year").classes("font-semibold")
154-
ui.label(f"Total files: {self.stats["year_files"]}").classes("text-sm")
155-
ui.label(f"Total transcription time: {year_time}").classes("text-sm")
162+
ui.label(f"Transcribed files this year: {self.stats["year_files"]}").classes("text-sm")
163+
ui.label(f"Transcription time this year: {year_time}").classes("text-sm")
156164

157165
with ui.column().style("flex: 0 0 auto;"):
158166

@@ -615,7 +623,7 @@ def admin() -> None:
615623
groups = sorted(
616624
groups_get()["result"],
617625
key=lambda x: (x["name"].lower() != "all users", x["name"].lower())
618-
)
626+
)
619627
for group in groups:
620628
g = Group(
621629
group_id=group["id"],
@@ -671,13 +679,11 @@ def users() -> None:
671679
{"name": "username", "label": "Username", "field": "username", "align": "left", "sortable": True},
672680
{"name": "realm", "label": "Realm", "field": "realm", "align": "left", "sortable": True},
673681
{"name": "role", "label": "Admin", "field": "admin", "align": "left", "sortable": True},
674-
675-
# Make sure the domains field is wide enough to show multiple domains
676682
{"name": "domains", "label": "Domains", "field": "admin_domains", "align": "left", "sortable": False, "style": "max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"},
677683
{"name": "active", "label": "Active", "field": "active", "align": "left", "sortable": True},
678684
],
679685
rows=users,
680-
selection="single",
686+
selection="multiple",
681687
pagination=20,
682688
on_select=lambda e: None,
683689
).style("width: 100%; box-shadow: none; font-size: 18px; height: calc(100vh - 300px);")

0 commit comments

Comments
 (0)