greenhat 0.3.2 → 0.3.3
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 +4 -4
- data/lib/greenhat/shell/shell_helper.rb +10 -3
- data/lib/greenhat/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac7b0e70e5a13dc6f8f88a4f12fec812e38e7d838537abe83b7d4dc2e8b43663
|
4
|
+
data.tar.gz: 84246bc31bd38af74e9f4f8d95f2f7ffa1ca33978dc0d0862ec0b50eaff20196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba104ea8d7b4e52babf8bdf27ea4f3dbdb9e92820589881bab639a01e8558c355389a0f10b3c17dbe5c7ac881f10364ad06ec0c973934f06d735f948bb57fbd3
|
7
|
+
data.tar.gz: a2013229826758ca61335f5cf8d58c3a4a4206e656dce084f90781c264e4930c5c3fd09b7475a43dd31819bc2562e85e5799de775cc5db9dfaa3f73c0228ac3a
|
@@ -368,7 +368,7 @@ module GreenHat
|
|
368
368
|
|
369
369
|
# Loop through Stats, Separate Hash/Tables
|
370
370
|
stats.map do |field|
|
371
|
-
occurrences = filter_count_occurrences(results, field)
|
371
|
+
occurrences = filter_count_occurrences(results, field, flags)
|
372
372
|
|
373
373
|
# Total Occurences
|
374
374
|
total = occurrences.values.sum
|
@@ -405,10 +405,17 @@ module GreenHat
|
|
405
405
|
end
|
406
406
|
|
407
407
|
# Helper to Count occurrences
|
408
|
-
def self.filter_count_occurrences(results, field)
|
408
|
+
def self.filter_count_occurrences(results, field, flags = {})
|
409
409
|
results.each_with_object(Hash.new(0)) do |entry, counts|
|
410
410
|
if entry.key? field
|
411
|
-
|
411
|
+
# Rounding in pagination breaks stats
|
412
|
+
key = if flags.key?(:round) && entry[field].numeric?
|
413
|
+
entry[field].to_f.round(flags.round)
|
414
|
+
else
|
415
|
+
entry[field]
|
416
|
+
end
|
417
|
+
|
418
|
+
counts[key] += 1
|
412
419
|
else
|
413
420
|
counts['None'.pastel(:bright_black)] += 1
|
414
421
|
end
|
data/lib/greenhat/version.rb
CHANGED