active-record-query-count 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c046d3b131f42ddba7b95dfb268363e8125fb6db8409874391f5b52e49a6a05
4
- data.tar.gz: 6d78754de10ab33e69fe52af796b5da3d7aaaf57dca845900ac5e020a4ed2830
3
+ metadata.gz: 303bdcd94b83dcbc64d15f3a9217f81b53396e999be47c4f1fa598f002585236
4
+ data.tar.gz: 3b6ecef679c7aeb8d4bcb8e0bd389b32f1e578ee92554f8e5fea4323cb7f513d
5
5
  SHA512:
6
- metadata.gz: 97d92a02a56f4a20c8a93cef3fb3484ccabd7c8c34b8773782b2e50734f02bb6c85d4872f82a70a4d628ed46554d7b27cd81827a3320af1723f02dfc597d834b
7
- data.tar.gz: dcffef1c47d8aa2449785ac6a5eae8da89b1910792840815cf66d2f7ba9bd763e70bced85396919e987885ec10c9b50aa9ccf0e09db3b80c0914dbb4a9da427f
6
+ metadata.gz: 96a894554b3da3d6ae8806b12a628a453f938ee11f72b5d196993f013066e3b5d05a02ae75c5fb66183376380d160de7696b615ebf1769c073ee4e2912462276
7
+ data.tar.gz: 18fe2806436b58b4c1f86b2968fd1ff89b0df8df854a0185a3752fbc530d0d9dfb2f36257aea34f321b5ea1ec79c6c6725174b86974f1f129b2fb49c23259378
data/README.md CHANGED
@@ -94,7 +94,7 @@ If you use `html` with WSL enviroment, you need to set on your enviroments varia
94
94
 
95
95
  ### Configuration options
96
96
 
97
- When visualizing the html table or the console output, tables with less than `ignore_table_count` will not be shown. Also, the amount of locations to show is given by `max_locations_per_table`
97
+ When visualizing the html table or the console output, tables with less than `ignore_table_count` will not be shown. Also, the amount of locations to show is given by `max_locations_per_table`. If `max_locations_per_table` is set to 0, all locations will be displayed without any limit.
98
98
 
99
99
  ```ruby
100
100
  config.after_initialize do
@@ -5,8 +5,12 @@
5
5
  <h2>Query Count Report</h2>
6
6
  <p>Total number of queries in this process: <%= total_query_count %></p>
7
7
  <p>Total time spent on queries in this process (ms): <%= total_duration_time %></p>
8
- <p>Only tables with <%= ::ActiveRecordQueryCount::Configuration.ignore_table_count %> or more queries will be displayed.</p>
8
+ <% if ::ActiveRecordQueryCount::Configuration.ignore_table_count > 1 %>
9
+ <p>Only tables with <%= ::ActiveRecordQueryCount::Configuration.ignore_table_count %> or more queries will be displayed.</p>
10
+ <% end %>
11
+ <% unless ::ActiveRecordQueryCount::Configuration.unlimited_locations_per_table? %>
9
12
  <p>The top <%= ::ActiveRecordQueryCount::Configuration.max_locations_per_table %> locations with the highest occurrences will be shown for each table.</p>
13
+ <% end %>
10
14
  <button id="toggleButton" onclick="toggleView()">Show Chart View</button>
11
15
  <button id="toggleColumnButton" onclick="toggleColumnContent()">Show SQL</button>
12
16
 
@@ -19,5 +19,9 @@ module ActiveRecordQueryCount
19
19
  def self.ignore_table_count
20
20
  ENV['QUERY_COUNT_IGNORE_TABLE_COUNT'] || @@ignore_table_count
21
21
  end
22
+
23
+ def self.unlimited_locations_per_table?
24
+ max_locations_per_table.zero?
25
+ end
22
26
  end
23
27
  end
@@ -19,6 +19,8 @@ module ActiveRecordQueryCount
19
19
  end
20
20
  data = data.select { |_, v| v[:count] >= Configuration.ignore_table_count }
21
21
  data = data.sort_by { |_, v| -v[:count] }.each do |_category, info|
22
+ next if Configuration.max_locations_per_table.zero?
23
+
22
24
  info[:location] = info[:location].sort_by do |_, detail|
23
25
  -detail[:count]
24
26
  end.first(Configuration.max_locations_per_table).to_h
@@ -11,8 +11,12 @@ module ActiveRecordQueryCount
11
11
  data = filter_data(@data)
12
12
  puts '[ActiveRecordQueryCount] Query count per table:'.colorize(:blue)
13
13
  puts "Total query count: #{data.values.sum { |v| v[:count] }}\n\n"
14
- puts "All tables with less than #{Configuration.ignore_table_count} queries are ignored. \n\n"
15
- puts "For each table, the top #{Configuration.max_locations_per_table} locations with the most queries will be shown.\n\n"
14
+ if Configuration.ignore_table_count > 1
15
+ puts "All tables with less than #{Configuration.ignore_table_count} queries are ignored. \n\n"
16
+ end
17
+ unless Configuration.unlimited_locations_per_table?
18
+ puts "For each table, the top #{Configuration.max_locations_per_table} locations with the most queries will be shown.\n\n"
19
+ end
16
20
  data.each do |category, info|
17
21
  puts "Table #{category.colorize(:cyan)}"
18
22
  puts " Total query count: #{info[:count].to_s.colorize(:blue)}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordQueryCount
4
- VERSION = '0.1.9'
4
+ VERSION = '0.1.11'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-record-query-count
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Lara
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-24 00:00:00.000000000 Z
11
+ date: 2026-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '8.0'
22
+ version: '9.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '5.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '8.0'
32
+ version: '9.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: colorize
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -99,7 +99,7 @@ dependencies:
99
99
  version: '5.0'
100
100
  - - "<"
101
101
  - !ruby/object:Gem::Version
102
- version: '8.0'
102
+ version: '9.0'
103
103
  type: :development
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: '5.0'
110
110
  - - "<"
111
111
  - !ruby/object:Gem::Version
112
- version: '8.0'
112
+ version: '9.0'
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: minitest
115
115
  requirement: !ruby/object:Gem::Requirement
@@ -236,7 +236,7 @@ dependencies:
236
236
  - - "~>"
237
237
  - !ruby/object:Gem::Version
238
238
  version: '1.4'
239
- description:
239
+ description:
240
240
  email:
241
241
  - jvlara@uc.cl
242
242
  executables: []
@@ -275,7 +275,7 @@ homepage: https://github.com/jvlara/active-record-query-count
275
275
  licenses:
276
276
  - MIT
277
277
  metadata: {}
278
- post_install_message:
278
+ post_install_message:
279
279
  rdoc_options: []
280
280
  require_paths:
281
281
  - lib
@@ -294,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
294
294
  version: '0'
295
295
  requirements: []
296
296
  rubygems_version: 3.4.10
297
- signing_key:
297
+ signing_key:
298
298
  specification_version: 4
299
299
  summary: Display an overview of the quantity of queries being made and their origins
300
300
  in a block of code in Rails applications.