Skip to content

Commit ef64d9e

Browse files
authored
fix: fix timebased charts display with groupdate 5.2 and ruby 3.0 (#462)
1 parent 9fce889 commit ef64d9e

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

app/services/forest_liana/line_stat_getter.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class LineStatGetter < StatGetter
55
def client_timezone
66
# As stated here https://github.com/ankane/groupdate#for-sqlite
77
# groupdate does not handle timezone for SQLite
8-
return nil if 'SQLite' == ActiveRecord::Base.connection.adapter_name
8+
return false if 'SQLite' == ActiveRecord::Base.connection.adapter_name
99
@params[:timezone]
1010
end
1111

@@ -31,9 +31,7 @@ def perform
3131

3232
Groupdate.week_start = :monday
3333

34-
value = value.send(time_range, group_by_date_field, {
35-
time_zone: client_timezone
36-
})
34+
value = value.send(time_range, group_by_date_field, time_zone: client_timezone)
3735

3836
value = value.send(@params[:aggregate].downcase, @params[:aggregate_field])
3937
.map do |k, v|

spec/services/forest_liana/line_stat_getter_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ module ForestLiana
22
describe LineStatGetter do
33
describe 'Check client_timezone function' do
44
describe 'with a SQLite database' do
5-
it 'should return nil' do
5+
it 'should return false' do
66
expect(LineStatGetter.new(Owner, {
77
timezone: "Europe/Paris",
88
aggregate: "Count",
9-
}).client_timezone).to eq(nil)
9+
}).client_timezone).to eq(false)
1010
end
1111
end
1212

0 commit comments

Comments
 (0)