github
0 of 18 new or added lines in 4 files covered. (0.0%)
3922 existing lines in 105 files now uncovered.0 of 4086 relevant lines covered (0.0%)
0.0 hits per line
1 |
# frozen_string_literal: true
|
|
2 |
|
|
UNCOV
3
|
module Stats |
× |
UNCOV
4
|
class Base |
× |
5 |
|
|
UNCOV
6
|
attr_reader :date_range
|
× |
7 |
|
|
UNCOV
8
|
class << self |
× |
9 |
|
|
UNCOV
10
|
def for(year, month = nil) |
× |
UNCOV
11
|
new(date_range_for(year, month)) |
× |
UNCOV
12
|
end
|
× |
13 |
|
|
UNCOV
14
|
private |
× |
15 |
|
|
UNCOV
16
|
def date_range_for(year, month = nil) |
× |
UNCOV
17
|
Date.new(year.to_i, (month || 1).to_i, 1)..Date.new(year.to_i, (month || 12).to_i, -1) |
× |
UNCOV
18
|
end
|
× |
19 |
|
|
UNCOV
20
|
end
|
× |
21 |
|
|
UNCOV
22
|
def initialize(date_range) |
× |
UNCOV
23
|
@date_range = date_range
|
× |
UNCOV
24
|
end
|
× |
25 |
|
|
UNCOV
26
|
private |
× |
27 |
|
|
UNCOV
28
|
def tracks |
× |
UNCOV
29
|
Track
|
× |
UNCOV
30
|
.within(date_range.first.at_beginning_of_day, date_range.last.at_end_of_day) |
× |
UNCOV
31
|
.joins(:broadcast)
|
× |
UNCOV
32
|
end
|
× |
33 |
|
|
UNCOV
34
|
def sort_counts(counts) |
× |
UNCOV
35
|
counts.sort_by { |key, value| [-value, key] }.to_h |
× |
UNCOV
36
|
end
|
× |
37 |
|
|
UNCOV
38
|
end
|
× |
UNCOV
39
|
end
|
× |