Skip to content

SQL panel fix for locales that use comma as a decimal separator. #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 10, 2011
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Timeline width in SQL panel properly scaled.
  • Loading branch information
Tomasz Buchert committed Jun 9, 2011
commit 9d32eb2c36f353565ee5738cd92805c1ea11d742
2 changes: 2 additions & 0 deletions debug_toolbar/panels/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ def content(self):
query['rgb_color'] = self._databases[alias]['rgb_color']
try:
query['width_ratio'] = (query['duration'] / self._sql_time) * 100
query['width_ratio_relative'] = 100.0 * query['width_ratio'] / (100.0 - width_ratio_tally)
except ZeroDivisionError:
query['width_ratio'] = 0
query['width_ratio_relative'] = 0
query['start_offset'] = width_ratio_tally
query['end_offset'] = query['width_ratio'] + query['start_offset']
width_ratio_tally += query['width_ratio']
Expand Down
2 changes: 1 addition & 1 deletion debug_toolbar/templates/debug_toolbar/panels/sql.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</div>
</td>
<td class="timeline">
<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|dotted_number }}%;">{{ query.width_ratio }}%</strong></div></div>
<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>
</td>
<td class="time">
{{ query.duration|floatformat:"2" }}
Expand Down