Skip to content
This repository was archived by the owner on Mar 15, 2025. It is now read-only.

Commit aeb4f98

Browse files
committed
Merge branch 'thnee-duration'
2 parents f805b07 + ae22fa1 commit aeb4f98

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

debug_toolbar_sqlalchemy/panel.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from debug_toolbar.panels import Panel
22
from debug_toolbar_sqlalchemy.operation_tracker import OperationTracker
3+
34
from django.utils.translation import ugettext as _
45
from django.template.loader import render_to_string
56

7+
68
class SqlAlchemyDebugPanel(Panel):
79
""" Panel that shows information about SQLAlchemy operations. """
810
name = 'SQLAlchemy'
@@ -20,7 +22,11 @@ def nav_title(self):
2022
def nav_subtitle(self):
2123
if self.tracker:
2224
count = len(self.tracker.queries)
23-
return "%d %s" % (count, "query" if count == 1 else "queries")
25+
return "%d %s in %.2fms" % (
26+
count,
27+
"query" if count == 1 else "queries",
28+
sum(map(lambda query: query.duration, self.tracker.queries)),
29+
)
2430

2531
return "Unavailable"
2632

@@ -36,4 +42,3 @@ def content(self):
3642
self.template,
3743
{'queries': self.tracker.queries}
3844
)
39-

debug_toolbar_sqlalchemy/templates/sqlalchemy-panel.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</div>
2323
</td>
2424
<td class="time">
25-
{{ query.duration|floatformat:"0" }}
25+
{{ query.duration|floatformat:2 }}
2626
</td>
2727
</tr>
2828
{% endfor %}

0 commit comments

Comments
 (0)