File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,6 @@ def index
1818 # その年末時点でアクティブだった道場を取得
1919 dojos_scope = Dojo . active_at ( end_of_year )
2020 @page_title = "#{ @selected_year } 年末時点のCoderDojo一覧"
21-
22- # 成功メッセージもinline_で表示
23- flash . now [ :inline_info ] = "#{ @selected_year } 年末時点のアクティブな道場を表示中"
2421 rescue ArgumentError
2522 flash [ :inline_alert ] = "無効な年が指定されました"
2623 return redirect_to dojos_path ( anchor : 'table' )
@@ -58,6 +55,12 @@ def index
5855
5956 # counter合計を計算(/statsとの照合用)
6057 @counter_sum = @dojos . sum { |d | d [ :counter ] }
58+
59+ # 年が選択されている場合、統計情報を含むメッセージを設定
60+ if @selected_year
61+ active_dojos_count = @dojos . count
62+ flash . now [ :inline_info ] = "#{ @selected_year } 年末時点のアクティブな道場を表示中<br>(開設道場数: #{ active_dojos_count } / 合計道場数: #{ @counter_sum } )" . html_safe
63+ end
6164
6265 respond_to do |format |
6366 format . html { render :index } # => app/views/dojos/index.html.erb
Original file line number Diff line number Diff line change 293293 get dojos_path ( year : 2020 )
294294 expect ( response . body ) . to include ( '2020年末時点' )
295295 expect ( response . body ) . to include ( 'アクティブな道場を表示中' )
296+ # 統計情報が含まれていることを確認(/statsページとの比較検証用)
297+ expect ( response . body ) . to include ( '開設道場数:' )
298+ expect ( response . body ) . to include ( '合計道場数:' )
296299 # inline_infoメッセージが表示されることを確認
297300 expect ( response . body ) . to include ( 'alert-info' )
298301 end
You can’t perform that action at this time.
0 commit comments