Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
thomasDOTwtf
hub
Commits
c357bdda
Commit
c357bdda
authored
Dec 27, 2023
by
grollicus
Committed by
HeJ
Dec 27, 2023
Browse files
Options
Downloads
Patches
Plain Diff
query all room counts at once
parent
37564cb5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/api/views/metrics.py
+7
-2
7 additions, 2 deletions
src/api/views/metrics.py
with
7 additions
and
2 deletions
src/api/views/metrics.py
+
7
−
2
View file @
c357bdda
...
@@ -70,8 +70,13 @@ class MetricsView(TemplateView):
...
@@ -70,8 +70,13 @@ class MetricsView(TemplateView):
self
.
report_assembly_metrics
(
metrics
,
conference
,
'
channel
'
,
'
channels
'
)
self
.
report_assembly_metrics
(
metrics
,
conference
,
'
channel
'
,
'
channels
'
)
# hub_conference_rooms
# hub_conference_rooms
for
room_type
in
Room
.
RoomType
.
values
:
room_counts
=
{
room_type
:
0
for
room_type
in
Room
.
RoomType
.
values
}
room_count
=
Room
.
objects
.
filter
(
conference
=
conference
,
room_type
=
Room
.
RoomType
(
room_type
)).
count
()
for
room_type
,
cnt
in
(
Room
.
objects
.
filter
(
conference
=
conference
).
values
(
'
room_type
'
).
annotate
(
cnt
=
Count
(
'
room_type
'
)).
values_list
(
'
room_type
'
,
'
cnt
'
)
):
room_counts
[
room_type
]
=
cnt
for
room_type
,
room_count
in
room_counts
.
items
():
metrics
[
'
hub_conference_rooms
'
][
'
values
'
][
f
'
{{conference=
"
{
slug
}
"
,room_type=
"
{
room_type
}
"
}}
'
]
=
room_count
metrics
[
'
hub_conference_rooms
'
][
'
values
'
][
f
'
{{conference=
"
{
slug
}
"
,room_type=
"
{
room_type
}
"
}}
'
]
=
room_count
# hub_conference_projects
# hub_conference_projects
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment