Skip to content

Commit 1ee8de9

Browse files
committed
feat: デフォルトページに「非アクティブ含む」情報を表示
全期間表示時に「全期間の道場を表示中(非アクティブ含む)」のメッセージを追加。 年別フィルタとの違いを明確化し、ユーザーの誤解を防止。 - デフォルト: 「全期間の道場を表示中(非アクティブ含む)」 - 年別フィルタ: 「YYYY年X月X日時点のアクティブな道場を表示中」 テストも追加し、25個すべてのテストが成功。
1 parent 56e44ba commit 1ee8de9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

app/controllers/dojos_controller.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def index
5656
# counter合計を計算(/statsとの照合用)
5757
@counter_sum = @dojos.sum { |d| d[:counter] }
5858

59-
# 年が選択されている場合、統計情報を含むメッセージを設定
59+
# 情報メッセージを設定
6060
if @selected_year
6161
# /statsページと同じ計算方法を使用
6262
# 開設数 = その年に新規開設されたDojoのcounter合計
@@ -72,6 +72,9 @@ def index
7272
display_date = Date.current.strftime('%Y年%-m月%-d日') if @selected_year == Date.current.year
7373

7474
flash.now[:inline_info] = "#{display_date}時点のアクティブな道場を表示中<br>(開設数: #{new_dojos_count} / 合計数: #{total_dojos_count})".html_safe
75+
else
76+
# 全期間表示時の情報メッセージ
77+
flash.now[:inline_info] = "全期間の道場を表示中(非アクティブ含む)"
7578
end
7679

7780
respond_to do |format|

spec/requests/dojos_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@
9191
expect(assigns(:dojos).map { |d| d[:id] }).to include(@dojo_2020_inactive.id)
9292
end
9393

94+
it "displays default message for all periods" do
95+
get dojos_path(format: :html)
96+
expect(response.body).to include('全期間の道場を表示中(非アクティブ含む)')
97+
expect(response.body).to include('alert-info')
98+
end
99+
94100
it "includes inactive dojos in CSV format" do
95101
get dojos_path(format: :csv)
96102
csv = CSV.parse(response.body, headers: true)

0 commit comments

Comments
 (0)