Add operation names to debug view
This commit is contained in:
parent
760e6accbd
commit
2251475bbe
2 changed files with 32 additions and 0 deletions
|
|
@ -7,6 +7,27 @@
|
||||||
<p>
|
<p>
|
||||||
Generated at: <time id="generation-time">{{ now }}</time>
|
Generated at: <time id="generation-time">{{ now }}</time>
|
||||||
</p>
|
</p>
|
||||||
|
<section>
|
||||||
|
<h2 id="operation-names-header">Distinct GraphQL operation_names ({{ operation_names_with_counts|length }})</h2>
|
||||||
|
{% if operation_names_with_counts %}
|
||||||
|
<table id="operation-names-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Operation Name</th>
|
||||||
|
<th>Count</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for item in operation_names_with_counts %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ item.trimmed_op }}</td>
|
||||||
|
<td>{{ item.count }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endif %}
|
||||||
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<h2 id="games-without-owner-header">Games Without an Assigned Owner ({{ games_without_owner|length }})</h2>
|
<h2 id="games-without-owner-header">Games Without an Assigned Owner ({{ games_without_owner|length }})</h2>
|
||||||
{% if games_without_owner %}
|
{% if games_without_owner %}
|
||||||
|
|
|
||||||
|
|
@ -950,6 +950,16 @@ def debug_view(request: HttpRequest) -> HttpResponse:
|
||||||
.select_related("game")
|
.select_related("game")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Distinct GraphQL operation names used to fetch campaigns with counts
|
||||||
|
operation_names_with_counts: list[dict[str, Any]] = list(
|
||||||
|
DropCampaign.objects
|
||||||
|
.annotate(trimmed_op=Trim("operation_name"))
|
||||||
|
.filter(~Q(trimmed_op__exact=""))
|
||||||
|
.values("trimmed_op")
|
||||||
|
.annotate(count=Count("twitch_id"))
|
||||||
|
.order_by("trimmed_op"),
|
||||||
|
)
|
||||||
|
|
||||||
context: dict[str, Any] = {
|
context: dict[str, Any] = {
|
||||||
"now": now,
|
"now": now,
|
||||||
"games_without_owner": games_without_owner,
|
"games_without_owner": games_without_owner,
|
||||||
|
|
@ -959,6 +969,7 @@ def debug_view(request: HttpRequest) -> HttpResponse:
|
||||||
"invalid_date_campaigns": invalid_date_campaigns,
|
"invalid_date_campaigns": invalid_date_campaigns,
|
||||||
"duplicate_name_campaigns": duplicate_name_campaigns,
|
"duplicate_name_campaigns": duplicate_name_campaigns,
|
||||||
"active_missing_image": active_missing_image,
|
"active_missing_image": active_missing_image,
|
||||||
|
"operation_names_with_counts": operation_names_with_counts,
|
||||||
}
|
}
|
||||||
|
|
||||||
return render(
|
return render(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue