Skip to content

直近のイベント情報の都道府県別集計の順序を修正 #466

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 1 commit into from
Jun 6, 2019

Conversation

chicaco
Copy link
Contributor

@chicaco chicaco commented Jun 5, 2019

背景

直近の CoderDojo 開催情報を、都道府県別に 都道府県コードの昇順 で表示したいが、先頭に来るはずの北海道が最後になってしまっている。

やりたいこと

都道府県別に 都道府県コードの昇順 に表示する。

Fix #465

@chicaco
Copy link
Contributor Author

chicaco commented Jun 5, 2019

本番機で動作を確認したところ、都道府県(Prefecture)T のデフォルトの並び順が id 順になっていなかった。 😱
明示的に order(:id) を指定することにより、期待した結果を得られることが分かった。

irb(main):001:0> Prefecture.all.ids
D, [2019-06-05T23:34:58.170713 #4] DEBUG -- :    (0.9ms)  SELECT "prefectures"."id" FROM "prefectures"
=> [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 1]
irb(main):002:0> Prefecture.order(:id).ids
D, [2019-06-05T23:39:25.241596 #4] DEBUG -- :    (3.0ms)  SELECT "prefectures"."id" FROM "prefectures" ORDER BY "prefectures"."id" ASC
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47]

※ ただし、ローカル開発環境では再現せず。

@chicaco chicaco requested a review from nalabjp June 5, 2019 14:56
@chicaco chicaco merged commit b6f03e3 into master Jun 6, 2019
@yasulab yasulab deleted the fix_upcoming_events_order branch June 6, 2019 06:04
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.

直近の CoderDojo 開催情報を表示するページで、都道府県順がおかしい
3 participants