Skip to content

Commit 4f908a5

Browse files
committed
modofied city_code.csv converters for nil
> つくば で order 値を検索したら order: '82201.0' になった...? [Qiitaのエントリ](https://qiita.com/fisherman08/items/84c0c380de96fa3ee591)によると 原因はCSVのconvertで、0始まりのデータの扱いが10進数として見られていなかった。 その為 :convertersをnilに変更して修正
1 parent 477f973 commit 4f908a5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/tasks/dojos.rake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ namespace :dojos do
2828

2929
dojos.each do |dojo|
3030
d = Dojo.find_or_initialize_by(id: dojo['id'])
31-
3231
d.name = dojo['name']
3332
d.email = ''
3433
d.order = dojo['order'] || search_order_number(dojo['name'])
@@ -49,7 +48,7 @@ namespace :dojos do
4948
def search_order_number(pre_city)
5049

5150
if /(?<city>.+)\s\(.+\)/ =~ pre_city
52-
table = CSV.table(Rails.root.join('db','city_code.csv'))
51+
table = CSV.table(Rails.root.join('db','city_code.csv'), {:converters => nil})
5352
row = table.find{ |r| r[:city].to_s.start_with?(city)}
5453
row ? row[:order] : raise("Failed to detect city code by #{pre_city}
5554
order値の自動設定ができませんでした。お手数ですが下記URLを参考に該当する全国地方公共団体コードをorder値にご入力ください。

0 commit comments

Comments
 (0)