Skip to content

Commit 2de1bbf

Browse files
authored
Merge branch 'main' into dependabot/bundler/turbo-rails-2.0.11
2 parents 84eca2d + 8a0e42f commit 2de1bbf

File tree

5 files changed

+44
-22
lines changed

5 files changed

+44
-22
lines changed

Gemfile.lock

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ GEM
162162
irb (~> 1.10)
163163
reline (>= 0.3.8)
164164
debug_inspector (1.2.0)
165-
delayed_job (4.1.11)
165+
delayed_job (4.1.12)
166166
activesupport (>= 3.0, < 8.0)
167-
delayed_job_active_record (4.1.8)
167+
delayed_job_active_record (4.1.10)
168168
activerecord (>= 3.0, < 8.0)
169169
delayed_job (>= 3.0, < 5)
170170
delayed_job_web (1.4.4)
@@ -209,15 +209,15 @@ GEM
209209
dry-inflector (~> 1.0)
210210
dry-logic (~> 1.4)
211211
zeitwerk (~> 2.6)
212-
erb_lint (0.6.0)
212+
erb_lint (0.7.0)
213213
activesupport
214214
better_html (>= 2.0.1)
215215
parser (>= 2.7.1.4)
216216
rainbow
217217
rubocop (>= 1)
218218
smart_properties
219219
erubi (1.13.0)
220-
execjs (2.9.1)
220+
execjs (2.10.0)
221221
factory_bot (6.4.5)
222222
activesupport (>= 5.0.0)
223223
factory_bot_rails (6.4.3)
@@ -259,14 +259,14 @@ GEM
259259
ffi (1.17.0-x86_64-darwin)
260260
ffi (1.17.0-x86_64-linux-gnu)
261261
filterrific (5.2.5)
262-
flipper (1.3.0)
262+
flipper (1.3.1)
263263
concurrent-ruby (< 2)
264264
flipper-active_record (1.3.0)
265265
activerecord (>= 4.2, < 8)
266266
flipper (~> 1.3.0)
267-
flipper-ui (1.3.0)
267+
flipper-ui (1.3.1)
268268
erubi (>= 1.0.0, < 2.0.0)
269-
flipper (~> 1.3.0)
269+
flipper (~> 1.3.1)
270270
rack (>= 1.4, < 4)
271271
rack-protection (>= 1.5.3, < 5.0.0)
272272
rack-session (>= 1.0.2, < 3.0.0)
@@ -321,7 +321,7 @@ GEM
321321
jbuilder (2.13.0)
322322
actionview (>= 5.0.0)
323323
activesupport (>= 5.0.0)
324-
json (2.7.2)
324+
json (2.7.5)
325325
jwt (2.9.1)
326326
base64
327327
kaminari (1.2.2)
@@ -442,7 +442,7 @@ GEM
442442
activerecord (>= 6.1)
443443
request_store (~> 1.4)
444444
parallel (1.26.3)
445-
parser (3.3.4.2)
445+
parser (3.3.5.1)
446446
ast (~> 2.4.1)
447447
racc
448448
pdf-core (0.9.0)
@@ -554,7 +554,7 @@ GEM
554554
responders (3.1.1)
555555
actionpack (>= 5.2)
556556
railties (>= 5.2)
557-
rexml (3.3.8)
557+
rexml (3.3.9)
558558
rolify (6.0.1)
559559
rouge (4.1.2)
560560
rspec (3.13.0)
@@ -589,9 +589,9 @@ GEM
589589
rubocop-ast (>= 1.31.1, < 2.0)
590590
ruby-progressbar (~> 1.7)
591591
unicode-display_width (>= 2.4.0, < 3.0)
592-
rubocop-ast (1.32.1)
592+
rubocop-ast (1.33.0)
593593
parser (>= 3.3.1.0)
594-
rubocop-performance (1.21.1)
594+
rubocop-performance (1.22.1)
595595
rubocop (>= 1.48.1, < 2.0)
596596
rubocop-ast (>= 1.31.1, < 2.0)
597597
rubocop-rails (2.25.1)
@@ -607,7 +607,7 @@ GEM
607607
ffi (~> 1.12)
608608
logger
609609
ruby2_keywords (0.0.5)
610-
sanitize (6.1.0)
610+
sanitize (6.1.3)
611611
crass (~> 1.0.2)
612612
nokogiri (>= 1.12.0)
613613
sass-rails (6.0.0)
@@ -659,15 +659,15 @@ GEM
659659
standard-custom (1.0.2)
660660
lint_roller (~> 1.0)
661661
rubocop (~> 1.50)
662-
standard-performance (1.4.0)
662+
standard-performance (1.5.0)
663663
lint_roller (~> 1.1)
664-
rubocop-performance (~> 1.21.0)
664+
rubocop-performance (~> 1.22.0)
665665
stimulus-rails (1.3.4)
666666
railties (>= 6.0.0)
667667
stringio (3.1.1)
668668
strong_migrations (1.8.0)
669669
activerecord (>= 5.2)
670-
terser (1.2.3)
670+
terser (1.2.4)
671671
execjs (>= 0.3.0, < 3)
672672
thor (1.3.2)
673673
tilt (2.2.0)
@@ -678,7 +678,7 @@ GEM
678678
railties (>= 6.0.0)
679679
tzinfo (2.0.6)
680680
concurrent-ruby (~> 1.0)
681-
unicode-display_width (2.5.0)
681+
unicode-display_width (2.6.0)
682682
uniform_notifier (1.16.0)
683683
version_gem (1.1.4)
684684
warden (1.2.9)

app/helpers/date_range_helper.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Encapsulates methods used on the Dashboard that need some business logic
22
module DateRangeHelper
33
def date_range_params
4-
params.dig(:filters, :date_range).presence || this_year
4+
params.dig(:filters, :date_range).presence || default_date
55
end
66

77
def date_range_label
@@ -23,8 +23,10 @@ def date_range_label
2323
end
2424
end
2525

26-
def this_year
27-
"January 1, #{Time.zone.today.year} - December 31, #{Time.zone.today.year}"
26+
def default_date
27+
start_date = 2.months.ago.to_date
28+
end_date = 1.month.from_now.to_date
29+
"#{start_date.strftime("%B %d, %Y")} - #{end_date.strftime("%B %d, %Y")}"
2830
end
2931

3032
def selected_interval

app/javascript/application.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ $(document).ready(function(){
9090
format: "MMMM D, YYYY",
9191
ranges: {
9292
customRanges: {
93+
'Default': [today.minus({'months': 2}).toJSDate(), today.plus({'months': 1}).toJSDate()],
9394
'All Time': [today.minus({ 'years': 100 }).toJSDate(), today.plus({ 'years': 1 }).toJSDate()],
9495
'Today': [today.toJSDate(), today.toJSDate()],
9596
'Yesterday': [today.minus({'days': 1}).toJSDate(), today.minus({'days': 1}).toJSDate()],

spec/support/date_range_picker_shared_example.rb

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,30 @@ def date_range_picker_select_range(range_name)
2020
let(:user) { create(:user, organization: organization) }
2121

2222
let!(:very_old) { create(described_class.to_s.underscore.to_sym, date_field.to_sym => Time.zone.local(2000, 7, 31), :organization => organization) }
23+
let!(:two_months_ago) { create(described_class.to_s.underscore.to_sym, date_field.to_sym => Time.zone.local(2019, 5, 31), :organization => organization) }
2324
let!(:recent) { create(described_class.to_s.underscore.to_sym, date_field.to_sym => Time.zone.local(2019, 7, 24), :organization => organization) }
2425
let!(:today) { create(described_class.to_s.underscore.to_sym, date_field.to_sym => Time.zone.local(2019, 7, 31), :organization => organization) }
26+
let!(:one_month_ahead) { create(described_class.to_s.underscore.to_sym, date_field.to_sym => Time.zone.local(2019, 8, 31), :organization => organization) }
2527
let!(:one_year_ahead) { create(described_class.to_s.underscore.to_sym, date_field.to_sym => Time.zone.local(2020, 7, 31), :organization => organization) }
2628
let!(:two_years_ahead) { create(described_class.to_s.underscore.to_sym, date_field.to_sym => Time.zone.local(2021, 7, 31), :organization => organization) }
2729

30+
context "when choosing 'Default'" do
31+
before do
32+
sign_out user
33+
travel_to Time.zone.local(2019, 7, 31)
34+
sign_in user
35+
end
36+
37+
after do
38+
travel_back
39+
end
40+
41+
it "shows only 4 records" do
42+
visit subject
43+
expect(page).to have_css("table tbody tr", count: 4)
44+
end
45+
end
46+
2847
context "when choosing 'All Time'" do
2948
before do
3049
sign_out user
@@ -41,7 +60,7 @@ def date_range_picker_select_range(range_name)
4160
date_range = "#{Time.zone.local(1919, 7, 1).to_formatted_s(:date_picker)} - #{Time.zone.local(2020, 7, 31).to_formatted_s(:date_picker)}"
4261
fill_in "filters_date_range", with: date_range
4362
find(:id, 'filters_date_range').native.send_keys(:enter)
44-
expect(page).to have_css("table tbody tr", count: 4)
63+
expect(page).to have_css("table tbody tr", count: 6)
4564
end
4665
end
4766

spec/system/product_drive_system_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
it "Shows the expected filters with the expected values and in alphabetical order for name filter" do
3030
expect(page.find("select[name='filters[by_name]']").find(:xpath, 'option[2]').text).to eq "Alpha Test name 3"
3131
expect(page.has_select?('filters[by_name]', with_options: @product_drives.map(&:name))).to be true
32-
expect(page.has_field?('filters_date_range', with: this_year))
32+
expect(page.has_field?('filters_date_range', with: default_date))
3333
end
3434

3535
it "shows the expected product drives" do

0 commit comments

Comments
 (0)