File tree 4 files changed +15
-1
lines changed
templates/debug_toolbar/panels
4 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -183,8 +183,10 @@ def content(self):
183
183
query ['rgb_color' ] = self ._databases [alias ]['rgb_color' ]
184
184
try :
185
185
query ['width_ratio' ] = (query ['duration' ] / self ._sql_time ) * 100
186
+ query ['width_ratio_relative' ] = 100.0 * query ['width_ratio' ] / (100.0 - width_ratio_tally )
186
187
except ZeroDivisionError :
187
188
query ['width_ratio' ] = 0
189
+ query ['width_ratio_relative' ] = 0
188
190
query ['start_offset' ] = width_ratio_tally
189
191
query ['end_offset' ] = query ['width_ratio' ] + query ['start_offset' ]
190
192
width_ratio_tally += query ['width_ratio' ]
Original file line number Diff line number Diff line change 1
1
{% load i18n %}
2
+ {% load debug_toolbar_utils %}
2
3
< div class ="clearfix ">
3
4
< ul class ="stats ">
4
5
{% for alias, info in databases %}
34
35
</ div >
35
36
</ td >
36
37
< td class ="timeline ">
37
- < div class ="djDebugTimeline "> < div class ="djDebugLineChart{% if query.is_slow %} djDebugLineChartWarning{% endif %} " style ="left:{{ query.start_offset }}%; "> < strong style ="width:{{ query.width_ratio }}%; "> {{ query.width_ratio }}%</ strong > </ div > </ div >
38
+ < div class ="djDebugTimeline "> < div class ="djDebugLineChart{% if query.is_slow %} djDebugLineChartWarning{% endif %} " style ="left:{{ query.start_offset|dotted_number }}%; "> < strong style ="width:{{ query.width_ratio_relative|dotted_number }}%; "> {{ query.width_ratio }}%</ strong > </ div > </ div >
38
39
</ td >
39
40
< td class ="time ">
40
41
{{ query.duration|floatformat:"2" }}
Original file line number Diff line number Diff line change
1
+
2
+ from django import template
3
+ from django .utils .numberformat import format
4
+
5
+ register = template .Library ()
6
+
7
+ @register .filter
8
+ def dotted_number (number ):
9
+ number = float (number )
10
+ return format (number , '.' , 6 )
11
+
You can’t perform that action at this time.
0 commit comments