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
18
18
# その年末時点でアクティブだった道場を取得
19
19
dojos_scope = Dojo . active_at ( end_of_year )
20
20
@page_title = "#{ @selected_year } 年末時点のCoderDojo一覧"
21
-
22
- # 成功メッセージもinline_で表示
23
- flash . now [ :inline_info ] = "#{ @selected_year } 年末時点のアクティブな道場を表示中"
24
21
rescue ArgumentError
25
22
flash [ :inline_alert ] = "無効な年が指定されました"
26
23
return redirect_to dojos_path ( anchor : 'table' )
@@ -58,6 +55,12 @@ def index
58
55
59
56
# counter合計を計算(/statsとの照合用)
60
57
@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
61
64
62
65
respond_to do |format |
63
66
format . html { render :index } # => app/views/dojos/index.html.erb
Original file line number Diff line number Diff line change 293
293
get dojos_path ( year : 2020 )
294
294
expect ( response . body ) . to include ( '2020年末時点' )
295
295
expect ( response . body ) . to include ( 'アクティブな道場を表示中' )
296
+ # 統計情報が含まれていることを確認(/statsページとの比較検証用)
297
+ expect ( response . body ) . to include ( '開設道場数:' )
298
+ expect ( response . body ) . to include ( '合計道場数:' )
296
299
# inline_infoメッセージが表示されることを確認
297
300
expect ( response . body ) . to include ( 'alert-info' )
298
301
end
You can’t perform that action at this time.
0 commit comments