Class: GoodJob::BaseChart
- Inherits:
-
Object
- Object
- GoodJob::BaseChart
show all
- Defined in:
- app/charts/good_job/base_chart.rb
Instance Method Summary
collapse
Instance Method Details
#start_end_binds ⇒ Object
5
6
7
8
9
10
11
12
13
|
# File 'app/charts/good_job/base_chart.rb', line 5
def start_end_binds
end_time = Time.current
start_time = end_time - 1.day
[
ActiveRecord::Relation::QueryAttribute.new('start_time', start_time, ActiveRecord::Type::DateTime.new),
ActiveRecord::Relation::QueryAttribute.new('end_time', end_time, ActiveRecord::Type::DateTime.new),
]
end
|
#string_to_hsl(string) ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'app/charts/good_job/base_chart.rb', line 15
def string_to_hsl(string)
hash_value = string.sum
hue = hash_value % 360
saturation = (hash_value % 50) + 50
lightness = '50'
"hsl(#{hue}, #{saturation}%, #{lightness}%)"
end
|