Skip to content

Commit 277cef0

Browse files
committed
improve: HTMLビューから道場数カラムを削除してシンプルに
- HTMLビューから道場数(counter)カラムを削除 - 道場名に☯️アイコンを復活 - 詳細な道場数はCSVで確認可能なため、HTMLはシンプルに保つ - CSVには引き続き道場数カラムと合計を表示 - テストもHTML/CSVの役割分担に合わせて更新
1 parent 3ef3301 commit 277cef0

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

app/views/dojos/index.html.erb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,11 @@
8989
<div style="margin-top: 20px;" align="center">
9090
<table border="1">
9191
<tr>
92-
<th>
93-
<small>
94-
🗾
95-
<br class='ignore-pc'>
96-
道場名 (ID 番号)
97-
</small>
98-
</th>
9992
<th>
10093
<small>
10194
☯️
10295
<br class='ignore-pc'>
103-
道場数
96+
道場名 (ID 番号)
10497
</small>
10598
</th>
10699
<th>
@@ -128,9 +121,6 @@
128121
<% end %>
129122
</small>
130123
</td>
131-
<td style="text-align: center;">
132-
<small><%= dojo[:counter] %></small>
133-
</td>
134124
<td>
135125
<small><%= dojo[:created_at].strftime("%F") %></small>
136126
</td>

spec/requests/dojos_spec.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,21 +178,26 @@
178178
expect(multi_branch_row["道場数"]).to eq("3")
179179
end
180180

181-
it "calculates counter_sum correctly" do
182-
get dojos_path(format: :html)
181+
it "calculates counter_sum correctly for CSV" do
182+
get dojos_path(format: :csv)
183183

184184
expected_sum = [@dojo_2020_active, @dojo_2020_inactive, @dojo_2021_active,
185185
@dojo_2019_inactive, @dojo_multi_branch].sum(&:counter)
186-
expect(assigns(:counter_sum)).to eq(expected_sum)
186+
# @counter_sum はCSVで使用されるので、CSVリクエスト時に検証
187+
csv = CSV.parse(response.body)
188+
last_line = csv.last
189+
expect(last_line[2]).to eq(expected_sum.to_s)
187190
end
188191

189-
it "calculates counter_sum for filtered year" do
190-
get dojos_path(year: 2020, format: :html)
192+
it "calculates counter_sum for filtered year in CSV" do
193+
get dojos_path(year: 2020, format: :csv)
191194

192195
# 2020年末時点でアクティブな道場のcounter合計
193196
active_in_2020 = [@dojo_2020_active, @dojo_2020_inactive, @dojo_multi_branch]
194197
expected_sum = active_in_2020.sum(&:counter)
195-
expect(assigns(:counter_sum)).to eq(expected_sum)
198+
csv = CSV.parse(response.body)
199+
last_line = csv.last
200+
expect(last_line[2]).to eq(expected_sum.to_s)
196201
end
197202
end
198203

0 commit comments

Comments
 (0)