Skip to content

Use 全国地方公共団体コード for Order #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Dec 11, 2017
Merged

Conversation

yasulab
Copy link
Member

@yasulab yasulab commented Dec 11, 2017

This will fix #219 and can be a step to automate inserting Order column (#58), which enables us to remove order from dojos.yaml.

@yasulab yasulab changed the title [WIP] Use 全国地方公共団体コード for Order culumn [WIP] Use 全国地方公共団体コード for Order column Dec 11, 2017
@yasulab yasulab changed the title [WIP] Use 全国地方公共団体コード for Order column [WIP] Use 全国地方公共団体コード for Order Dec 11, 2017
@yasulab yasulab changed the title [WIP] Use 全国地方公共団体コード for Order Use 全国地方公共団体コード for Order Dec 11, 2017
0 means octal number in Ruby, which breaks when sorting:
e.g. puts 010 => 8
@yasulab yasulab force-pushed the use-code-for-order branch 2 times, most recently from a2266ec to 87567c0 Compare December 11, 2017 11:59
Some Japanese codes for regions start with 0.
We should compare as String rather than Integer.
cf. #219
d.description = dojo['description']
d.logo = dojo['logo']
d.tags = dojo['tags']
d.url = dojo['url']
d.created_at = dojo['createdAt'] ? Time.zone.parse(dojo['createdAt']) : Time.zone.now
d.created_at = d.new_record? ? Time.zone.now : d.created_at
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue とは関係ないですが created_at が更新されてしまうバグを見つけたのでついでに直しました 🐛 🔍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

おぉ、これなにか意図があるのかと思っていました😱

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

やってしまったze! 🙈💦

@yasulab
Copy link
Member Author

yasulab commented Dec 11, 2017

@nalabjp 全国地方公共団体コードを order に当て込んでみました! ✅ こんな感じでどうですかね? 🤔 💭

@yasulab
Copy link
Member Author

yasulab commented Dec 11, 2017

.oO(CoderDojo 御茶ノ水からの申請が先ほどあったので、ついでにこのコミットに載せちゃいますね。master にコミットすると conflict しそうなので ><)

@yasulab
Copy link
Member Author

yasulab commented Dec 11, 2017

手元で動かして問題なさそうだったので、デプロイしてみます 🚀✨

@yasulab yasulab merged commit e075710 into master Dec 11, 2017
@yasulab yasulab deleted the use-code-for-order branch December 11, 2017 13:00
@@ -0,0 +1,6 @@
class ChangeOrderToInteger < ActiveRecord::Migration[5.1]
def change
change_column :dojos, :order, :string, default: '000000'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rollbackが必要になった時に戻せなくなる気がします。
こんな感じでup, downするほうが良いですね。
https://github.com/coderdojo-japan/coderdojo.jp/blob/5da47bf0e2541fc11a3ed7cc36bf75dab961fb66/db/migrate/20170820090605_change_column_type_dojo_event_services.rb

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

型の変更自体は 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるほど🤔 こっそり直せないか後で試してみます ><

@nalabjp
Copy link
Member

nalabjp commented Dec 11, 2017

良さそうに思いました😁
migrationのところだけ直しておきたい気がします😌

@yasulab
Copy link
Member Author

yasulab commented Dec 11, 2017

ですね 😆 レビューありがとうございます! 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dojo の表示順 (order) を全国地方公共団体コードにする
2 participants