lib/rails-footnotes/notes/queries_note.rb in rails3-footnotes-4.0.0.pre.3 vs lib/rails-footnotes/notes/queries_note.rb in rails3-footnotes-4.0.0.pre.4
- old
+ new
@@ -29,11 +29,11 @@
:queries
end
def title
queries = @@query_subscriber.events.length
- total_time = @@query_subscriber.events.inject(0){|sum, item| sum += item.payload[:duration]} / 1000.0
+ total_time = @@query_subscriber.events.map{|e| e.duration }.sum / 1000.0
query_color = generate_red_color(@@query_subscriber.events.length, alert_sql_number)
db_color = generate_red_color(total_time, alert_db_time)
<<-TITLE
<span style="background-color:#{query_color}">Queries (#{queries})</span>
@@ -53,10 +53,10 @@
def content
html = ''
@@query_subscriber.events.each_with_index do |item, i|
html << <<-HTML
- #{print_name_and_time(item.payload[:name], item.payload[:duration] / 1000.0)}
+ #{print_name_and_time(item.payload[:name], item.duration / 1000.0)}
<span id="explain_#{i}">#{print_query(item.payload[:sql])}</span><br />
HTML
end
return html