From 27c14a861034620313c28078b2528991a266345c Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sun, 18 Aug 2024 23:02:07 +0900 Subject: [PATCH 01/34] =?UTF-8?q?=E5=9C=B0=E5=9F=9F=E5=88=A5=E3=83=A6?= =?UTF-8?q?=E3=83=BC=E3=82=B6=E3=83=BC=E3=81=AE=E4=B8=80=E8=A6=A7=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E3=81=AE=E9=9D=9EReact=E7=89=88=E3=82=92=E4=BD=9C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 既存コードの削除は未実施 - ページネーションは未実施 --- app/controllers/users/areas_controller.rb | 1 + app/models/area.rb | 24 ++++++++++++++++++ app/views/users/areas/index.html.slim | 31 +++++++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/app/controllers/users/areas_controller.rb b/app/controllers/users/areas_controller.rb index 78354e589a5..ae5c6fea5ca 100644 --- a/app/controllers/users/areas_controller.rb +++ b/app/controllers/users/areas_controller.rb @@ -3,5 +3,6 @@ class Users::AreasController < ApplicationController def index @number_of_users_by_region = Area.number_of_users_by_region + @users_group_by_areas = Area.sorted_users_group_by_areas end end diff --git a/app/models/area.rb b/app/models/area.rb index 798c3006cd3..c8023e6bc81 100644 --- a/app/models/area.rb +++ b/app/models/area.rb @@ -62,6 +62,19 @@ def number_of_users_by_region end end + def sorted_users_group_by_areas + users_group_by_areas = User.with_attached_avatar.all.group_by do |user| + users_group_by_area(user) + end + + sorted_users_group_by_areas = + users_group_by_areas.map do |area, users| + { users: users.sort_by(&:created_at).reverse, area: } unless area.nil? + end.compact + + sorted_users_group_by_areas.sort_by { |hash| -hash[:users].size } + end + private def country_subdivision_pairs @@ -97,5 +110,16 @@ def select_region(subdivision, result) end result end + + def users_group_by_area(user) + if user.country_code == 'JP' + subdivision = ISO3166::Country['JP'].subdivisions[user.subdivision_code] + # subdivision&.name + subdivision.translations['ja'] + else + country = ISO3166::Country[user.country_code] + country ? country.translations['ja'] : nil + end + end end end diff --git a/app/views/users/areas/index.html.slim b/app/views/users/areas/index.html.slim index 26672aa976a..78b1dacc932 100644 --- a/app/views/users/areas/index.html.slim +++ b/app/views/users/areas/index.html.slim @@ -19,3 +19,34 @@ main.page-main h1.page-main-header__title 都道府県別 hr.a-border = react_component('Users/FilterByArea', numberOfUsersByRegion: @number_of_users_by_region) + + .page-body + .container.is-lg + .page-body__columns.is-reverse + .page-body__column.is-sub.is-sm + - @number_of_users_by_region.each do |region, _| + nav.page-nav.a-card + header.page-nav__header + h2.page-nav__title + span.page-nav__title-inner = region + hr.a-border-tint + ul.page-nav__items + - @number_of_users_by_region[region].each do |area, number_of_users| + li.page-nav__item + a.page-nav__item-link.a-text-link href="#dummy-link" + | #{area}(#{number_of_users}) + .page-body__column.is-main + - if @users_group_by_areas.any? + - @users_group_by_areas.each do |users_group_by_area| + section.a-card + .user-group + header.user-group__header + h2.user-group__title = users_group_by_area[:area] + .a-user-icons + .a-user-icons__items + - users_group_by_area[:users].each do |user| + a.a-user-icons__item-link href=user.url + span.a-user-role class="is-#{user.primary_role}" + img.a-user-icons__item-icon.a-user-icon src=user.avatar_url title=user.icon_title data-login-name=user.login_name + - else + .empty-message 都道府県別ユーザー一覧はありません From f7147d489e93ccbfff4ca7d046d66157bbbcd9d8 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Wed, 21 Aug 2024 21:14:42 +0900 Subject: [PATCH 02/34] =?UTF-8?q?=E3=83=9A=E3=83=BC=E3=82=B8=E3=83=8D?= =?UTF-8?q?=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=92=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users/areas_controller.rb | 2 +- app/views/users/areas/index.html.slim | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/users/areas_controller.rb b/app/controllers/users/areas_controller.rb index ae5c6fea5ca..03169e600e1 100644 --- a/app/controllers/users/areas_controller.rb +++ b/app/controllers/users/areas_controller.rb @@ -3,6 +3,6 @@ class Users::AreasController < ApplicationController def index @number_of_users_by_region = Area.number_of_users_by_region - @users_group_by_areas = Area.sorted_users_group_by_areas + @users_group_by_areas = Kaminari.paginate_array(Area.sorted_users_group_by_areas).page(params[:page]).per(20) end end diff --git a/app/views/users/areas/index.html.slim b/app/views/users/areas/index.html.slim index 78b1dacc932..199d1727551 100644 --- a/app/views/users/areas/index.html.slim +++ b/app/views/users/areas/index.html.slim @@ -48,5 +48,6 @@ main.page-main a.a-user-icons__item-link href=user.url span.a-user-role class="is-#{user.primary_role}" img.a-user-icons__item-icon.a-user-icon src=user.avatar_url title=user.icon_title data-login-name=user.login_name + = paginate @users_group_by_areas - else .empty-message 都道府県別ユーザー一覧はありません From 57c24ec4a1311d605c3e4a3d8e17fabda6afeb02 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sun, 25 Aug 2024 19:05:45 +0900 Subject: [PATCH 03/34] =?UTF-8?q?=E9=83=BD=E9=81=93=E5=BA=9C=E7=9C=8C?= =?UTF-8?q?=E3=81=AB=E5=AF=BE=E3=81=99=E3=82=8B=E3=83=A6=E3=83=BC=E3=82=B6?= =?UTF-8?q?=E3=83=BC=E4=B8=80=E8=A6=A7=E3=83=9A=E3=83=BC=E3=82=B8=E3=82=92?= =?UTF-8?q?=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - サイドメニューは未実装 --- app/controllers/users/areas_controller.rb | 7 ++++++- app/models/area.rb | 16 ++++++++++++++- app/views/users/areas/index.html.slim | 6 +++--- app/views/users/areas/show.html.slim | 25 +++++++++++++++++++++++ config/routes/users.rb | 1 + 5 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 app/views/users/areas/show.html.slim diff --git a/app/controllers/users/areas_controller.rb b/app/controllers/users/areas_controller.rb index 03169e600e1..0fc20c9caa8 100644 --- a/app/controllers/users/areas_controller.rb +++ b/app/controllers/users/areas_controller.rb @@ -3,6 +3,11 @@ class Users::AreasController < ApplicationController def index @number_of_users_by_region = Area.number_of_users_by_region - @users_group_by_areas = Kaminari.paginate_array(Area.sorted_users_group_by_areas).page(params[:page]).per(20) + @users_group_by_areas = Kaminari.paginate_array(Area.sorted_users_group_by_areas).page(params[:page]).per(15) + end + + def show + @area = params[:area_name] + @users = Area.users_by_area(@area).page(params[:page]).per(15) end end diff --git a/app/models/area.rb b/app/models/area.rb index c8023e6bc81..d1dcd66dd12 100644 --- a/app/models/area.rb +++ b/app/models/area.rb @@ -36,6 +36,20 @@ def users(region, area) end end + def users_by_area(area) + if subdivision = ISO3166::Country[:JP].find_subdivision_by_name(area) + User + .with_attached_avatar + .where(subdivision_code: subdivision.code.to_s) + elsif country = ISO3166::Country.find_country_by_any_name(area) + User + .with_attached_avatar + .where(country_code: country.alpha2) + else + User.none + end + end + # regionとareaによって分類されたユーザー数をハッシュで取得して返す関数 # country_codeかsubdivision_codeのどちらかがnullのユーザーのデータは無視されます # @@ -111,10 +125,10 @@ def select_region(subdivision, result) result end + # TODO: メソッド名を修正する def users_group_by_area(user) if user.country_code == 'JP' subdivision = ISO3166::Country['JP'].subdivisions[user.subdivision_code] - # subdivision&.name subdivision.translations['ja'] else country = ISO3166::Country[user.country_code] diff --git a/app/views/users/areas/index.html.slim b/app/views/users/areas/index.html.slim index 199d1727551..cfb0cb56748 100644 --- a/app/views/users/areas/index.html.slim +++ b/app/views/users/areas/index.html.slim @@ -33,15 +33,15 @@ main.page-main ul.page-nav__items - @number_of_users_by_region[region].each do |area, number_of_users| li.page-nav__item - a.page-nav__item-link.a-text-link href="#dummy-link" - | #{area}(#{number_of_users}) + = link_to "#{area}(#{number_of_users})", users_area_path(area_name: area), class: 'page-nav__item-link a-text-link' .page-body__column.is-main - if @users_group_by_areas.any? - @users_group_by_areas.each do |users_group_by_area| section.a-card .user-group header.user-group__header - h2.user-group__title = users_group_by_area[:area] + h2.user-group__title + = link_to users_group_by_area[:area], users_area_path(area_name: users_group_by_area[:area]), class: 'user-group__title-link' .a-user-icons .a-user-icons__items - users_group_by_area[:users].each do |user| diff --git a/app/views/users/areas/show.html.slim b/app/views/users/areas/show.html.slim new file mode 100644 index 00000000000..764f2222f8f --- /dev/null +++ b/app/views/users/areas/show.html.slim @@ -0,0 +1,25 @@ +- title "#{@area}のユーザー一覧" +- set_meta_tags description: "#{@area}のユーザー一覧ページです。" + +header.page-header + .container + .page-header__inner + .page-header__start + h2.page-header__title ユーザー一覧 + .page-header__end + .page-header-actions + ul.page-header-actions__items + += render '/users/lg_page_tabs' + +main.page-main + header.page-main-header + .container + .page-main-header__inner + h1.page-main-header__title + = @area + hr.a-border + .page-body + .container.is-lg + = render '/users/user_list', users: @users + diff --git a/config/routes/users.rb b/config/routes/users.rb index dd732c2993b..28552c9ee8d 100644 --- a/config/routes/users.rb +++ b/config/routes/users.rb @@ -6,6 +6,7 @@ get "tags", to: "tags#index" resources :companies, only: %i(index) resources :areas, only: %i(index) + get "areas/:area_name", to: "areas#show", as: :area end resources :users, only: %i(index show new create) do From e97e1bd235ae7c9188586b2c0e4b0974fa5b34f8 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sun, 25 Aug 2024 19:25:11 +0900 Subject: [PATCH 04/34] =?UTF-8?q?=E9=83=BD=E9=81=93=E5=BA=9C=E7=9C=8C?= =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E4=B8=80=E8=A6=A7=E3=83=9A?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=81=AB=E9=83=BD=E9=81=93=E5=BA=9C=E7=9C=8C?= =?UTF-8?q?=E4=B8=80=E8=A6=A7=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=B8=E6=88=BB?= =?UTF-8?q?=E3=82=8B=E3=83=9C=E3=82=BF=E3=83=B3=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/areas/show.html.slim | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/views/users/areas/show.html.slim b/app/views/users/areas/show.html.slim index 764f2222f8f..8df203cda10 100644 --- a/app/views/users/areas/show.html.slim +++ b/app/views/users/areas/show.html.slim @@ -6,9 +6,6 @@ header.page-header .page-header__inner .page-header__start h2.page-header__title ユーザー一覧 - .page-header__end - .page-header-actions - ul.page-header-actions__items = render '/users/lg_page_tabs' @@ -16,8 +13,15 @@ main.page-main header.page-main-header .container .page-main-header__inner - h1.page-main-header__title - = @area + .page-main-header__start + h1.page-main-header__title + = @area + .page-main-header__end + .page-main-header-actions + ul.page-main-header-actions__items + li.page-main-header-actions__item + = link_to users_areas_path, class: 'a-button is-sm is-block is-secondary is-back' do + | 都道府県一覧 hr.a-border .page-body .container.is-lg From 1ffe9aa5d0cada936e83cc51c1aa78411a680d36 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sun, 25 Aug 2024 19:32:08 +0900 Subject: [PATCH 05/34] =?UTF-8?q?=E9=83=BD=E9=81=93=E5=BA=9C=E7=9C=8C?= =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E4=B8=80=E8=A6=A7=E3=83=9A?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=81=AB=E3=82=B5=E3=82=A4=E3=83=89=E3=83=A1?= =?UTF-8?q?=E3=83=8B=E3=83=A5=E3=83=BC=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users/areas_controller.rb | 1 + app/views/users/areas/show.html.slim | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/controllers/users/areas_controller.rb b/app/controllers/users/areas_controller.rb index 0fc20c9caa8..6e65292e06a 100644 --- a/app/controllers/users/areas_controller.rb +++ b/app/controllers/users/areas_controller.rb @@ -9,5 +9,6 @@ def index def show @area = params[:area_name] @users = Area.users_by_area(@area).page(params[:page]).per(15) + @number_of_users_by_region = Area.number_of_users_by_region end end diff --git a/app/views/users/areas/show.html.slim b/app/views/users/areas/show.html.slim index 8df203cda10..5b0ecf62648 100644 --- a/app/views/users/areas/show.html.slim +++ b/app/views/users/areas/show.html.slim @@ -24,6 +24,19 @@ main.page-main | 都道府県一覧 hr.a-border .page-body - .container.is-lg - = render '/users/user_list', users: @users + .container + .page-body__columns.is-reverse + .page-body__column.is-sub.is-sm + - @number_of_users_by_region.each do |region, _| + nav.page-nav.a-card + header.page-nav__header + h2.page-nav__title + span.page-nav__title-inner = region + hr.a-border-tint + ul.page-nav__items + - @number_of_users_by_region[region].each do |area, number_of_users| + li.page-nav__item + = link_to "#{area}(#{number_of_users})", users_area_path(area_name: area), class: 'page-nav__item-link a-text-link' + .page-body__column.is-main + = render '/users/user_list', users: @users From bd228051494ea2ce38c9e0a4d814ed2d0c962d7a Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sun, 25 Aug 2024 19:42:47 +0900 Subject: [PATCH 06/34] =?UTF-8?q?=E3=82=B5=E3=82=A4=E3=83=89=E3=83=A1?= =?UTF-8?q?=E3=83=8B=E3=83=A5=E3=83=BC=E3=82=92=E3=83=91=E3=83=BC=E3=82=B7?= =?UTF-8?q?=E3=83=A3=E3=83=AB=E3=81=AB=E5=88=87=E3=82=8A=E5=87=BA=E3=81=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/areas/_areas_menu.html.slim | 10 ++++++++++ app/views/users/areas/index.html.slim | 11 +---------- app/views/users/areas/show.html.slim | 11 +---------- 3 files changed, 12 insertions(+), 20 deletions(-) create mode 100644 app/views/users/areas/_areas_menu.html.slim diff --git a/app/views/users/areas/_areas_menu.html.slim b/app/views/users/areas/_areas_menu.html.slim new file mode 100644 index 00000000000..37864ade521 --- /dev/null +++ b/app/views/users/areas/_areas_menu.html.slim @@ -0,0 +1,10 @@ +- number_of_users_by_region.each do |region, _| + nav.page-nav.a-card + header.page-nav__header + h2.page-nav__title + span.page-nav__title-inner = region + hr.a-border-tint + ul.page-nav__items + - number_of_users_by_region[region].each do |area, number_of_users| + li.page-nav__item + = link_to "#{area}(#{number_of_users})", users_area_path(area_name: area), class: 'page-nav__item-link a-text-link' diff --git a/app/views/users/areas/index.html.slim b/app/views/users/areas/index.html.slim index cfb0cb56748..8bd6942d143 100644 --- a/app/views/users/areas/index.html.slim +++ b/app/views/users/areas/index.html.slim @@ -24,16 +24,7 @@ main.page-main .container.is-lg .page-body__columns.is-reverse .page-body__column.is-sub.is-sm - - @number_of_users_by_region.each do |region, _| - nav.page-nav.a-card - header.page-nav__header - h2.page-nav__title - span.page-nav__title-inner = region - hr.a-border-tint - ul.page-nav__items - - @number_of_users_by_region[region].each do |area, number_of_users| - li.page-nav__item - = link_to "#{area}(#{number_of_users})", users_area_path(area_name: area), class: 'page-nav__item-link a-text-link' + = render 'areas_menu', number_of_users_by_region: @number_of_users_by_region .page-body__column.is-main - if @users_group_by_areas.any? - @users_group_by_areas.each do |users_group_by_area| diff --git a/app/views/users/areas/show.html.slim b/app/views/users/areas/show.html.slim index 5b0ecf62648..df3f3841a82 100644 --- a/app/views/users/areas/show.html.slim +++ b/app/views/users/areas/show.html.slim @@ -27,16 +27,7 @@ main.page-main .container .page-body__columns.is-reverse .page-body__column.is-sub.is-sm - - @number_of_users_by_region.each do |region, _| - nav.page-nav.a-card - header.page-nav__header - h2.page-nav__title - span.page-nav__title-inner = region - hr.a-border-tint - ul.page-nav__items - - @number_of_users_by_region[region].each do |area, number_of_users| - li.page-nav__item - = link_to "#{area}(#{number_of_users})", users_area_path(area_name: area), class: 'page-nav__item-link a-text-link' + = render 'areas_menu', number_of_users_by_region: @number_of_users_by_region .page-body__column.is-main = render '/users/user_list', users: @users From 48b6ac7f54d611e8848dc0789d6ca0ef48a10087 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sun, 25 Aug 2024 22:05:44 +0900 Subject: [PATCH 07/34] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=81=AA=E3=82=B3?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/users/areas_controller.rb | 8 -- .../components/Users/FilterByArea.jsx | 102 ------------------ .../components/layout/MultiColumns.jsx | 38 ------- app/javascript/components/ui/EmptyMessage.jsx | 12 --- app/javascript/hooks/useLocation.js | 52 --------- app/javascript/hooks/useSearchParams.js | 95 ---------------- app/models/area.rb | 17 --- app/views/api/users/areas/index.json.jbuilder | 3 - 8 files changed, 327 deletions(-) delete mode 100644 app/controllers/api/users/areas_controller.rb delete mode 100644 app/javascript/components/Users/FilterByArea.jsx delete mode 100644 app/javascript/components/layout/MultiColumns.jsx delete mode 100644 app/javascript/components/ui/EmptyMessage.jsx delete mode 100644 app/javascript/hooks/useLocation.js delete mode 100644 app/javascript/hooks/useSearchParams.js delete mode 100644 app/views/api/users/areas/index.json.jbuilder diff --git a/app/controllers/api/users/areas_controller.rb b/app/controllers/api/users/areas_controller.rb deleted file mode 100644 index 2d5313bec6d..00000000000 --- a/app/controllers/api/users/areas_controller.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -class API::Users::AreasController < API::BaseController - def index - tokyo_area_id = '13' - @users = Area.users(params[:region], params[:area] || tokyo_area_id) - end -end diff --git a/app/javascript/components/Users/FilterByArea.jsx b/app/javascript/components/Users/FilterByArea.jsx deleted file mode 100644 index 458da29a876..00000000000 --- a/app/javascript/components/Users/FilterByArea.jsx +++ /dev/null @@ -1,102 +0,0 @@ -import React from 'react' -// components -import LoadingListPlaceholder from '../LoadingListPlaceholder' -import EmptyMessage from '../ui/EmptyMessage' -import { UserGroup } from '../ui/UserGroup' -import { MultiColumns } from '../layout/MultiColumns' -// hooks -import { useSearchParams, usePopstate } from '../../hooks/useSearchParams' -import useSWR from 'swr' -// helper -import fetcher from '../../fetcher' - -function RegionCard({ region, numberOfUsersByRegion, onUpdateSelectedArea }) { - return ( - - ) -} - -/** - * 都道府県を指定しないデフォルトでは東京都が選択されます - */ -export default function FilterByArea({ numberOfUsersByRegion }) { - const { searchParams, setSearchParams } = useSearchParams({ area: '東京都' }) - const apiUrl = '/api/users/areas?' - const { data: users, error, mutate } = useSWR(apiUrl + searchParams, fetcher) - - const handleUpdateSelectedArea = async ({ region, area }) => { - const search = new URLSearchParams({ region, area }) - const newUsers = await fetcher(apiUrl + search).catch((error) => { - console.error(error) - }) - mutate(newUsers) - setSearchParams(search) - } - - usePopstate(async () => { - const newUsers = await fetcher(apiUrl + searchParams).catch((error) => { - console.error(error) - }) - mutate(newUsers) - }) - - if (error) return <>エラーが発生しました。 - if (!users) { - return ( -
-
- -
-
- ) - } - - return ( - - {/* region毎に区分されたareaの選択一覧 */} - - {Object.keys(numberOfUsersByRegion).map((region) => ( - - ))} - - {/* 選択されたareaのユーザー一覧 */} - -
- {users.length > 0 ? ( - - - {searchParams.get('area') || '東京都'} - - - - ) : ( - 都道府県別ユーザー一覧はありません - )} -
-
-
- ) -} diff --git a/app/javascript/components/layout/MultiColumns.jsx b/app/javascript/components/layout/MultiColumns.jsx deleted file mode 100644 index 9d632af7e9b..00000000000 --- a/app/javascript/components/layout/MultiColumns.jsx +++ /dev/null @@ -1,38 +0,0 @@ -import React from 'react' -import clsx from 'clsx' - -export const MultiColumns = ({ - className, - children, - isReverse = false, - ...props -}) => { - return ( -
-
-
- {children} -
-
-
- ) -} - -const MultiColumnsMain = ({ className, children, ...props }) => { - return ( -
- {children} -
- ) -} - -const MultiColumnsSub = ({ className, children, ...props }) => { - return ( -
- {children} -
- ) -} - -MultiColumns.Main = MultiColumnsMain -MultiColumns.Sub = MultiColumnsSub diff --git a/app/javascript/components/ui/EmptyMessage.jsx b/app/javascript/components/ui/EmptyMessage.jsx deleted file mode 100644 index 1e596d05e37..00000000000 --- a/app/javascript/components/ui/EmptyMessage.jsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react' - -export default function EmptyMessage({ children }) { - return ( -
-
- -
-

{children}

-
- ) -} diff --git a/app/javascript/hooks/useLocation.js b/app/javascript/hooks/useLocation.js deleted file mode 100644 index dabbb3abdcd..00000000000 --- a/app/javascript/hooks/useLocation.js +++ /dev/null @@ -1,52 +0,0 @@ -// React18にアップデートしたらshimを使うのを辞めてください -import { useSyncExternalStore } from 'use-sync-external-store/shim' - -// Proxyを使ってhistoryのメソッド呼び出しに合わせてイベントを発行する処理を挟みます -// https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Proxy -// Navigation APIには対応していません -// https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API -function proxyHistoryMethod(method) { - const handler = { - // applyの関数は関数呼び出し時に実行されます - // https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/apply - apply: function (target, thisArg, argumentsList) { - const event = new Event(method.toLowerCase()) - window.dispatchEvent(event) - return Reflect.apply(target, thisArg, argumentsList) - } - } - - history[method] = new Proxy(history[method], handler) -} - -// historyのメソッドをproxyに置き換える -proxyHistoryMethod('pushState') -proxyHistoryMethod('replaceState') - -function subscribe(callback) { - window.addEventListener('pushstate', callback) - window.addEventListener('replacestate', callback) - window.addEventListener('popstate', callback) - return () => { - window.removeEventListener('pushstate', callback) - window.removeEventListener('replacestate', callback) - window.removeEventListener('popstate', callback) - } -} - -/** - * URLが変わる度に再レンダリングを起こして新しいlocationを返すhookです - * レンダリングされる瞬間にlocationを使う(locationの内容が表示に関係している) - * 場合に使って下さい - * @param {(location) => any} [selector=null] - locationの一部分だけ使いたい場合は関数を渡すことも出来ます - * @example - * location.pathnameのみ欲しい場合の例 - * const pathname = useLocation((location) => location.pathname) - * - * @see 参考 https://ja.react.dev/learn/lifecycle-of-reactive-effects#can-global-or-mutable-values-be-dependencies - */ -function useLocation(selector = (location) => location) { - return useSyncExternalStore(subscribe, () => selector(location)) -} - -export { useLocation } diff --git a/app/javascript/hooks/useSearchParams.js b/app/javascript/hooks/useSearchParams.js deleted file mode 100644 index 14870854424..00000000000 --- a/app/javascript/hooks/useSearchParams.js +++ /dev/null @@ -1,95 +0,0 @@ -import { useRef, useEffect } from 'react' -import { useLocation } from './useLocation' - -function createSearchParams(init = '') { - return new URLSearchParams( - typeof init === 'string' || - Array.isArray(init) || - init instanceof URLSearchParams - ? init - : Object.keys(init).reduce((memo, key) => { - const value = init[key] - return memo.concat( - Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]] - ) - }, []) - ) -} - -function getSearchParamsForLocation(locationSearch, defaultSearchParams) { - const searchParams = createSearchParams(locationSearch) - - if (defaultSearchParams) { - defaultSearchParams.forEach((_, key) => { - if (!searchParams.has(key)) { - defaultSearchParams.getAll(key).forEach((value) => { - searchParams.append(key, value) - }) - } - }) - } - - return searchParams -} - -/** - * React RouterのuseSearchParamsと同じように動きます - * @see https://reactrouter.com/en/main/hooks/use-search-params - */ -function useSearchParams(defaultInit) { - const defaultSearchParamsRef = useRef(createSearchParams(defaultInit)) - const hasSetSearchParamsRef = useRef(false) - const search = useLocation((location) => location.search) - const searchParams = getSearchParamsForLocation( - search, - hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current - ) - - const defaultOptions = { - replace: false, - state: null, - preventScrollReset: false - } - - const setSearchParams = ( - nextInit, - { replace, state, preventScrollReset } = defaultOptions - ) => { - const newSearchParams = createSearchParams( - typeof nextInit === 'function' ? nextInit(searchParams) : nextInit - ) - hasSetSearchParamsRef.current = true - if (replace) { - history.replaceState(state, '', '?' + newSearchParams) - } else { - history.pushState(state, '', '?' + newSearchParams) - } - if (!preventScrollReset) { - window.scrollTo(0, 0) - } - } - - return { searchParams, setSearchParams } -} - -/** - * @see https://usehooks-ts.com/react-hook/use-event-listener - */ -function usePopstate(handler) { - const savedHandler = useRef(handler) - - useEffect(() => { - savedHandler.current = handler - }, [handler]) - - useEffect(() => { - if (!(window && window.addEventListener)) return - const listener = (event) => savedHandler.current(event) - window.addEventListener('popstate', listener) - return () => { - window.removeEventListener('popstate', listener) - } - }, []) -} - -export { useSearchParams, usePopstate } diff --git a/app/models/area.rb b/app/models/area.rb index d1dcd66dd12..468123c4655 100644 --- a/app/models/area.rb +++ b/app/models/area.rb @@ -19,23 +19,6 @@ class Area }.freeze class << self - # 指定したregionとareaのユーザーを全て取得して返す関数 - # regionはareaをカテゴリーに分類します 日本の地域区分名か海外になります - # areaは場所を表す最小単位です 都道府県名か国名になります - def users(region, area) - if region == '海外' - country = ISO3166::Country.find_country_by_any_name(area) - User - .with_attached_avatar - .where(country_code: country.alpha2) - else - subdivision_code = ISO3166::Country[:JP].find_subdivision_by_name(area).code - User - .with_attached_avatar - .where(subdivision_code: subdivision_code.to_s) - end - end - def users_by_area(area) if subdivision = ISO3166::Country[:JP].find_subdivision_by_name(area) User diff --git a/app/views/api/users/areas/index.json.jbuilder b/app/views/api/users/areas/index.json.jbuilder deleted file mode 100644 index 19130de305c..00000000000 --- a/app/views/api/users/areas/index.json.jbuilder +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: true - -json.array! @users, partial: "api/users/user", as: :user From e384a7acdae1b2f6de1ae4fed2f24e30c0410da5 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sun, 25 Aug 2024 22:09:10 +0900 Subject: [PATCH 08/34] =?UTF-8?q?rubocop=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/area.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/area.rb b/app/models/area.rb index 468123c4655..c8bea5e9d2a 100644 --- a/app/models/area.rb +++ b/app/models/area.rb @@ -20,11 +20,11 @@ class Area class << self def users_by_area(area) - if subdivision = ISO3166::Country[:JP].find_subdivision_by_name(area) + if (subdivision = ISO3166::Country[:JP].find_subdivision_by_name(area)) User .with_attached_avatar .where(subdivision_code: subdivision.code.to_s) - elsif country = ISO3166::Country.find_country_by_any_name(area) + elsif (country = ISO3166::Country.find_country_by_any_name(area)) User .with_attached_avatar .where(country_code: country.alpha2) From f7cc969af2b15dbe94568e488f7021758b16da5b Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sun, 25 Aug 2024 22:21:35 +0900 Subject: [PATCH 09/34] =?UTF-8?q?React=E3=82=92=E5=91=BC=E3=81=B3=E5=87=BA?= =?UTF-8?q?=E3=81=99=E4=B8=8D=E8=A6=81=E3=81=AA=E3=82=B3=E3=83=BC=E3=83=89?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/areas/index.html.slim | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/users/areas/index.html.slim b/app/views/users/areas/index.html.slim index 8bd6942d143..fa7f2d44239 100644 --- a/app/views/users/areas/index.html.slim +++ b/app/views/users/areas/index.html.slim @@ -18,7 +18,6 @@ main.page-main .page-main-header__inner h1.page-main-header__title 都道府県別 hr.a-border - = react_component('Users/FilterByArea', numberOfUsersByRegion: @number_of_users_by_region) .page-body .container.is-lg From 96a555d4f22ff584be73b1115e0dac78e1bc9276 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sun, 25 Aug 2024 22:22:04 +0900 Subject: [PATCH 10/34] =?UTF-8?q?=E9=83=BD=E9=81=93=E5=BA=9C=E7=9C=8C?= =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E4=B8=80=E8=A6=A7=E3=83=9A?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=81=A7=E3=82=82=E3=82=BF=E3=83=96=E3=81=8C?= =?UTF-8?q?=E3=82=A2=E3=82=AF=E3=83=86=E3=82=A3=E3=83=96=E3=81=AB=E3=81=AA?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_lg_page_tabs.html.slim | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 app/views/users/_lg_page_tabs.html.slim diff --git a/app/views/users/_lg_page_tabs.html.slim b/app/views/users/_lg_page_tabs.html.slim new file mode 100644 index 00000000000..e69de29bb2d From 4e5b116644a71c363998ab47d2781370b6f9d645 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sun, 25 Aug 2024 22:56:40 +0900 Subject: [PATCH 11/34] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=81=AA=E8=A1=8C?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/areas/show.html.slim | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/users/areas/show.html.slim b/app/views/users/areas/show.html.slim index df3f3841a82..cf500edc88c 100644 --- a/app/views/users/areas/show.html.slim +++ b/app/views/users/areas/show.html.slim @@ -30,4 +30,3 @@ main.page-main = render 'areas_menu', number_of_users_by_region: @number_of_users_by_region .page-body__column.is-main = render '/users/user_list', users: @users - From fb85bb273423ae6da51e48a1694bc920f9949508 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Wed, 28 Aug 2024 10:32:51 +0900 Subject: [PATCH 12/34] =?UTF-8?q?=E9=83=BD=E9=81=93=E5=BA=9C=E7=9C=8C?= =?UTF-8?q?=E4=B8=80=E8=A6=A7=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=AE=E4=B8=8A?= =?UTF-8?q?=E9=83=A8=E3=81=AB=E3=82=82=E3=83=9A=E3=83=BC=E3=82=B8=E3=83=8D?= =?UTF-8?q?=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/areas/index.html.slim | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/users/areas/index.html.slim b/app/views/users/areas/index.html.slim index fa7f2d44239..db77b55a2cb 100644 --- a/app/views/users/areas/index.html.slim +++ b/app/views/users/areas/index.html.slim @@ -26,6 +26,7 @@ main.page-main = render 'areas_menu', number_of_users_by_region: @number_of_users_by_region .page-body__column.is-main - if @users_group_by_areas.any? + = paginate @users_group_by_areas - @users_group_by_areas.each do |users_group_by_area| section.a-card .user-group From dc2192c68f59309d02ddd6533dee009379cd88af Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Wed, 28 Aug 2024 10:34:14 +0900 Subject: [PATCH 13/34] =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC?= =?UTF-8?q?=E4=B8=80=E8=A6=A7=E3=81=AE=E6=97=A2=E5=AD=98=E3=81=AE=E3=83=91?= =?UTF-8?q?=E3=83=BC=E3=82=B7=E3=83=A3=E3=83=AB=E3=81=8Cusers=5Fcontroller?= =?UTF-8?q?=E4=BB=A5=E5=A4=96=E3=81=AB=E5=AF=BE=E5=BF=9C=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=81=AA=E3=81=84=E3=81=9F=E3=82=81=E3=80=81areas=5Fc?= =?UTF-8?q?ontroller=E3=81=AB=E5=AF=BE=E5=BF=9C=E3=81=99=E3=82=8B=E3=83=91?= =?UTF-8?q?=E3=83=BC=E3=82=B7=E3=83=A3=E3=83=AB=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/areas/_user_list.html.slim | 14 ++++++++++++++ app/views/users/areas/show.html.slim | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 app/views/users/areas/_user_list.html.slim diff --git a/app/views/users/areas/_user_list.html.slim b/app/views/users/areas/_user_list.html.slim new file mode 100644 index 00000000000..d4be51ecdbf --- /dev/null +++ b/app/views/users/areas/_user_list.html.slim @@ -0,0 +1,14 @@ +- if users.present? + .user-list + = paginate users + .row + - users.each do |user| + = render 'users/user', user: + = paginate users +- else + .row + .o-empty-message + .o-empty-message__icon + i.fa-regular.fa-sad-tear + p.o-empty-message__text + | まだユーザーはいません diff --git a/app/views/users/areas/show.html.slim b/app/views/users/areas/show.html.slim index cf500edc88c..757a9f45d49 100644 --- a/app/views/users/areas/show.html.slim +++ b/app/views/users/areas/show.html.slim @@ -29,4 +29,4 @@ main.page-main .page-body__column.is-sub.is-sm = render 'areas_menu', number_of_users_by_region: @number_of_users_by_region .page-body__column.is-main - = render '/users/user_list', users: @users + = render 'user_list', users: @users From a332d5e5c07a795ec6463c8e9b04bcd707c286ca Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Wed, 28 Aug 2024 10:35:23 +0900 Subject: [PATCH 14/34] =?UTF-8?q?subdivision=E3=81=8Cnil=E3=81=AE=E5=A0=B4?= =?UTF-8?q?=E5=90=88=E3=81=AFnil=E3=82=92=E8=BF=94=E3=81=99=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/area.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/area.rb b/app/models/area.rb index c8bea5e9d2a..a22416b1db5 100644 --- a/app/models/area.rb +++ b/app/models/area.rb @@ -112,7 +112,7 @@ def select_region(subdivision, result) def users_group_by_area(user) if user.country_code == 'JP' subdivision = ISO3166::Country['JP'].subdivisions[user.subdivision_code] - subdivision.translations['ja'] + subdivision ? subdivision.translations['ja'] : nil else country = ISO3166::Country[user.country_code] country ? country.translations['ja'] : nil From cceb280ab7558c272a3548aa43698cdf55f92cb4 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Wed, 28 Aug 2024 10:43:10 +0900 Subject: [PATCH 15/34] =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC?= =?UTF-8?q?=E3=81=8C=E4=BD=8F=E3=82=93=E3=81=A7=E3=81=84=E3=82=8Barea?= =?UTF-8?q?=E3=82=92=E5=8F=96=E5=BE=97=E3=81=99=E3=82=8B=E3=83=A1=E3=82=BD?= =?UTF-8?q?=E3=83=83=E3=83=89=E3=82=92user=E3=83=A2=E3=83=87=E3=83=AB?= =?UTF-8?q?=E3=81=AB=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/area.rb | 15 +-------------- app/models/user.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/app/models/area.rb b/app/models/area.rb index a22416b1db5..4552961a19c 100644 --- a/app/models/area.rb +++ b/app/models/area.rb @@ -60,9 +60,7 @@ def number_of_users_by_region end def sorted_users_group_by_areas - users_group_by_areas = User.with_attached_avatar.all.group_by do |user| - users_group_by_area(user) - end + users_group_by_areas = User.with_attached_avatar.all.group_by(&:area) sorted_users_group_by_areas = users_group_by_areas.map do |area, users| @@ -107,16 +105,5 @@ def select_region(subdivision, result) end result end - - # TODO: メソッド名を修正する - def users_group_by_area(user) - if user.country_code == 'JP' - subdivision = ISO3166::Country['JP'].subdivisions[user.subdivision_code] - subdivision ? subdivision.translations['ja'] : nil - else - country = ISO3166::Country[user.country_code] - country ? country.translations['ja'] : nil - end - end end end diff --git a/app/models/user.rb b/app/models/user.rb index fa00d32173c..a0c67d39c55 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -835,6 +835,16 @@ def participated_regular_event_ids RegularEvent.where(id: regular_event_participations.pluck(:regular_event_id), finished: false) end + def area + if country_code == 'JP' + subdivision = ISO3166::Country['JP'].subdivisions[subdivision_code] + subdivision ? subdivision.translations['ja'] : nil + else + country = ISO3166::Country[country_code] + country ? country.translations['ja'] : nil + end + end + private def password_required? From ca96661aa58c5c19bac459aaeca39725eeb8cc90 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Wed, 28 Aug 2024 15:49:30 +0900 Subject: [PATCH 16/34] =?UTF-8?q?=E3=82=B7=E3=82=B9=E3=83=86=E3=83=A0?= =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/fixtures/users.yml | 4 ++ test/fixtures/users.yml | 4 ++ test/system/user/areas_test.rb | 75 ++++++++++++++++++++++++++-------- 3 files changed, 65 insertions(+), 18 deletions(-) diff --git a/db/fixtures/users.yml b/db/fixtures/users.yml index 4aa74d7f2c2..2f30dbfe32a 100644 --- a/db/fixtures/users.yml +++ b/db/fixtures/users.yml @@ -31,6 +31,8 @@ komagata: profile_name: "駒形 真幸" profile_job: "エンジニア" profile_text: "株式会社ロッカの代表兼エンジニア。Rubyが大好きで怖話、フィヨルドブートキャンプなどを開発している。" + country_code: JP + subdivision_code: '13' machida: login_name: machida @@ -60,6 +62,8 @@ machida: profile_name: "町田 哲平" profile_job: "デザイナー" profile_text: "株式会社ロッカのデザイナー。Ruby on Railsを使ったWebアプリを中心に多くのプロジェクトに参加。仙台で行われたRubyKaigi 2018のデザイン担当。フィヨルドブートキャンプでは主に HTML と CSS のレビュー担当。" + country_code: JP + subdivision_code: '13' sotugyou_with_job: login_name: sotugyou-with-job diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index aa71bdc1fb8..a0d9e531345 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -34,6 +34,8 @@ komagata: profile_name: "駒形 真幸" profile_job: "エンジニア" profile_text: "株式会社ロッカの代表兼エンジニア。Rubyが大好きで怖話、フィヨルドブートキャンプなどを開発している。" + country_code: JP + subdivision_code: '13' machida: login_name: machida @@ -62,6 +64,8 @@ machida: profile_name: "町田 哲平" profile_job: "デザイナー" profile_text: "株式会社ロッカのデザイナー。Ruby on Railsを使ったWebアプリを中心に多くのプロジェクトに参加。仙台で行われたRubyKaigi 2018のデザイン担当。フィヨルドブートキャンプでは主に HTML と CSS のレビュー担当。" + country_code: JP + subdivision_code: '13' adminonly: # adminのroleだけを持ったユーザー login_name: adminonly diff --git a/test/system/user/areas_test.rb b/test/system/user/areas_test.rb index e29d863e772..7484112ae2c 100644 --- a/test/system/user/areas_test.rb +++ b/test/system/user/areas_test.rb @@ -3,30 +3,69 @@ require 'application_system_test_case' class User::AreasTest < ApplicationSystemTestCase - test 'show tokyo users without search params' do - visit_with_auth '/users/areas', 'komagata' - assert_equal '都道府県別ユーザー一覧 | FBC', title - within "[data-testid='areas']" do - assert_text '関東地方' - assert_text '東京都' - assert_selector "[data-login-name='kimura']" + test 'show side menu' do + visit_with_auth '/users/areas', 'kimura' + within '.page-body__column.is-sub' do + assert_selector 'nav.page-nav.a-card', count: 3 + assert_selector 'h2.page-nav__title', text: '関東地方' + assert_selector 'a.page-nav__item-link', text: '東京都(3)' + assert_selector 'a.page-nav__item-link', text: '栃木県(1)' + assert_selector 'h2.page-nav__title', text: '九州・沖縄地方' + assert_selector 'a.page-nav__item-link', text: '長崎県(1)' + assert_selector 'h2.page-nav__title', text: '海外' + assert_selector 'a.page-nav__item-link', text: '米国(2)' + assert_selector 'a.page-nav__item-link', text: 'カナダ(1)' + + click_on '東京都(3)' + end + + assert_selector 'h1.page-main-header__title', text: '東京都' + within '.page-body__column.is-sub' do + assert_selector '.a-card', count: 3 + end + end + + test 'show areas' do + visit_with_auth '/users/areas', 'kimura' + assert_selector 'h1.page-main-header__title', text: '都道府県別' + within '.page-body__column.is-main' do + assert_selector '.user-group', count: 5 + assert_selector 'h2.user-group__title', text: '東京都' + assert_selector 'h2.user-group__title', text: '米国' + assert_selector 'h2.user-group__title', text: '栃木県' + assert_selector 'h2.user-group__title', text: 'カナダ' + assert_selector 'h2.user-group__title', text: '長崎県' + + click_on '東京都' end + + assert_selector 'h1.page-main-header__title', text: '東京都' end - test 'show selected subdivision or country users by search params' do - query = URI.encode_www_form(region: '九州・沖縄地方', area: '長崎県') - visit_with_auth "/users/areas?#{query}", 'komagata' - within "[data-testid='areas']" do - assert_text '長崎県' - assert_selector "[data-login-name='advisernocolleguetrainee']" + test 'show user icons in area card' do + visit_with_auth '/users/areas', 'kimura' + within '.user-group', match: :first do + assert_selector 'img.a-user-icon', count: 3 + assert_selector 'img.a-user-icon[data-login-name="kimura"]' + assert_selector 'img.a-user-icon[data-login-name="komagata"]' + assert_selector 'img.a-user-icon[data-login-name="machida"]' end end - test 'show empty message when no users exist' do - query = URI.encode_www_form(region: '関東地方', area: '神奈川県') - visit_with_auth "/users/areas?#{query}", 'komagata' - within "[data-testid='areas']" do - assert_text '都道府県別ユーザー一覧はありません' + test 'show users by area' do + visit_with_auth users_area_path(area_name: '東京都'), 'kimura' + assert_selector 'h1.page-main-header__title', text: '東京都' + within '.page-body__column.is-main' do + assert_selector '.users-item', count: 3 + assert_selector 'a.card-list-item-title__title', text: 'kimura' + assert_selector 'a.card-list-item-title__title', text: 'komagata' + assert_selector 'a.card-list-item-title__title', text: 'machida' end end + + test 'show message when visit area with no one' do + visit_with_auth users_area_path(area_name: '茨城県'), 'kimura' + assert_selector 'h1.page-main-header__title', text: '茨城県' + assert_text 'まだユーザーはいません' + end end From c33f6f218a05793625872c439f1d922eb817d773 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Wed, 28 Aug 2024 18:40:14 +0900 Subject: [PATCH 17/34] =?UTF-8?q?=E3=83=A2=E3=83=87=E3=83=AB=E3=83=86?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/models/area_test.rb | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/test/models/area_test.rb b/test/models/area_test.rb index 8af514c97ee..a66f2b3515e 100644 --- a/test/models/area_test.rb +++ b/test/models/area_test.rb @@ -3,16 +3,35 @@ require 'test_helper' class AreaTest < ActiveSupport::TestCase - test '#users' do - assert_includes Area.users('海外', '米国'), users(:tom) - assert_includes Area.users('関東地方', '東京都'), users(:kimura) + test '#users_by_area' do + tokyo_users = [users(:komagata), users(:machida), users(:kimura)] + assert_equal Area.users_by_area('東京都').to_a.sort, tokyo_users.sort + america_users = [users(:neverlogin), users(:tom)] + assert_equal Area.users_by_area('米国').to_a.sort, america_users.sort end test '#number_of_users_by_region' do assert_equal Area.number_of_users_by_region, { - '関東地方' => { '東京都' => 1, '栃木県' => 1 }, + '関東地方' => { '東京都' => 3, '栃木県' => 1 }, '九州・沖縄地方' => { '長崎県' => 1 }, '海外' => { '米国' => 2, 'カナダ' => 1 } } end + + test '#sorted_users_group_by_areas' do + sorted_users_group_by_areas = Area.sorted_users_group_by_areas + tokyo_users = [users(:komagata), users(:machida), users(:kimura)].sort_by(&:created_at).reverse + tochigi_users = [users(:kyuukai)] + nagasaki_users = [users(:advisernocolleguetrainee)] + america_users = [users(:neverlogin), users(:tom)].sort_by(&:created_at).reverse + canada_users = [users(:sotsugyoukigyoshozoku)] + + assert_equal sorted_users_group_by_areas[0][:area], '東京都' + assert_equal sorted_users_group_by_areas[1][:area], '米国' + assert_equal sorted_users_group_by_areas.detect { _1[:area] == '東京都' }[:users], tokyo_users + assert_equal sorted_users_group_by_areas.detect { _1[:area] == '米国' }[:users], america_users + assert_equal sorted_users_group_by_areas.detect { _1[:area] == '栃木県' }[:users], tochigi_users + assert_equal sorted_users_group_by_areas.detect { _1[:area] == '長崎県' }[:users], nagasaki_users + assert_equal sorted_users_group_by_areas.detect { _1[:area] == 'カナダ' }[:users], canada_users + end end From 8b7573a6eb8b05f13b4d6738bfc21f28931afe95 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Wed, 28 Aug 2024 23:24:57 +0900 Subject: [PATCH 18/34] =?UTF-8?q?=E6=97=A2=E5=AD=98=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=81=A8=E5=B9=B2=E6=B8=89=E3=81=99=E3=82=8B=E3=81=9F?= =?UTF-8?q?=E3=82=81=E3=80=81area=E3=82=92=E6=8C=81=E3=81=9F=E3=81=9B?= =?UTF-8?q?=E3=82=8Bfixture=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/fixtures/users.yml | 5 +++-- test/models/area_test.rb | 4 ++-- test/system/user/areas_test.rb | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index a0d9e531345..88f85bb71eb 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -34,8 +34,6 @@ komagata: profile_name: "駒形 真幸" profile_job: "エンジニア" profile_text: "株式会社ロッカの代表兼エンジニア。Rubyが大好きで怖話、フィヨルドブートキャンプなどを開発している。" - country_code: JP - subdivision_code: '13' machida: login_name: machida @@ -91,6 +89,9 @@ adminonly: # adminのroleだけを持ったユーザー created_at: "2021-02-01 00:00:30" last_activity_at: "2021-02-01 00:00:30" sent_student_followup_message: true + country_code: JP + subdivision_code: '13' + sotugyou_with_job: login_name: sotugyou-with-job diff --git a/test/models/area_test.rb b/test/models/area_test.rb index a66f2b3515e..9d474184109 100644 --- a/test/models/area_test.rb +++ b/test/models/area_test.rb @@ -4,7 +4,7 @@ class AreaTest < ActiveSupport::TestCase test '#users_by_area' do - tokyo_users = [users(:komagata), users(:machida), users(:kimura)] + tokyo_users = [users(:adminonly), users(:machida), users(:kimura)] assert_equal Area.users_by_area('東京都').to_a.sort, tokyo_users.sort america_users = [users(:neverlogin), users(:tom)] assert_equal Area.users_by_area('米国').to_a.sort, america_users.sort @@ -20,7 +20,7 @@ class AreaTest < ActiveSupport::TestCase test '#sorted_users_group_by_areas' do sorted_users_group_by_areas = Area.sorted_users_group_by_areas - tokyo_users = [users(:komagata), users(:machida), users(:kimura)].sort_by(&:created_at).reverse + tokyo_users = [users(:adminonly), users(:machida), users(:kimura)].sort_by(&:created_at).reverse tochigi_users = [users(:kyuukai)] nagasaki_users = [users(:advisernocolleguetrainee)] america_users = [users(:neverlogin), users(:tom)].sort_by(&:created_at).reverse diff --git a/test/system/user/areas_test.rb b/test/system/user/areas_test.rb index 7484112ae2c..345d2cb051b 100644 --- a/test/system/user/areas_test.rb +++ b/test/system/user/areas_test.rb @@ -47,7 +47,7 @@ class User::AreasTest < ApplicationSystemTestCase within '.user-group', match: :first do assert_selector 'img.a-user-icon', count: 3 assert_selector 'img.a-user-icon[data-login-name="kimura"]' - assert_selector 'img.a-user-icon[data-login-name="komagata"]' + assert_selector 'img.a-user-icon[data-login-name="adminonly"]' assert_selector 'img.a-user-icon[data-login-name="machida"]' end end @@ -58,7 +58,7 @@ class User::AreasTest < ApplicationSystemTestCase within '.page-body__column.is-main' do assert_selector '.users-item', count: 3 assert_selector 'a.card-list-item-title__title', text: 'kimura' - assert_selector 'a.card-list-item-title__title', text: 'komagata' + assert_selector 'a.card-list-item-title__title', text: 'adminonly' assert_selector 'a.card-list-item-title__title', text: 'machida' end end From 969cac38882e2878f2527fa082a3c01cbaba57af Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Wed, 28 Aug 2024 23:33:35 +0900 Subject: [PATCH 19/34] =?UTF-8?q?area=E3=81=8B=E3=82=89=E7=A7=BB=E5=8B=95?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E3=81=AE?= =?UTF-8?q?=E3=83=A2=E3=83=87=E3=83=AB=E3=83=86=E3=82=B9=E3=83=88=E3=82=92?= =?UTF-8?q?=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/models/user_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/models/user_test.rb b/test/models/user_test.rb index 47ad7a96595..c4e5eb11cc4 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -730,4 +730,13 @@ class UserTest < ActiveSupport::TestCase test '.users_job returns all users when invalid job is passed' do assert_equal User.all, User.users_job('destroy_all') end + + test 'area' do + tokyo_user = users(:machida) + america_user = users(:tom) + no_area_user = users(:komagata) + assert_equal tokyo_user.area, '東京都' + assert_equal america_user.area, '米国' + assert_equal no_area_user.area, nil + end end From e6b1325f93166cc4dbb6cbc149a012563e8e1d8c Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sun, 8 Sep 2024 18:27:49 +0900 Subject: [PATCH 20/34] =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=BC=8F=E3=81=A7?= =?UTF-8?q?=E3=81=AE=E4=BB=A3=E5=85=A5=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/area.rb | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/app/models/area.rb b/app/models/area.rb index 4552961a19c..b174e173021 100644 --- a/app/models/area.rb +++ b/app/models/area.rb @@ -20,17 +20,13 @@ class Area class << self def users_by_area(area) - if (subdivision = ISO3166::Country[:JP].find_subdivision_by_name(area)) - User - .with_attached_avatar - .where(subdivision_code: subdivision.code.to_s) - elsif (country = ISO3166::Country.find_country_by_any_name(area)) - User - .with_attached_avatar - .where(country_code: country.alpha2) - else - User.none - end + subdivision = ISO3166::Country[:JP].find_subdivision_by_name(area) + return User.with_attached_avatar.where(subdivision_code: subdivision.code.to_s) if subdivision + + country = ISO3166::Country.find_country_by_any_name(area) + return User.with_attached_avatar.where(country_code: country.alpha2) if country + + User.none end # regionとareaによって分類されたユーザー数をハッシュで取得して返す関数 From 4c80b7c1f16816eacf441aafdbe6cef2f7ce12f3 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sun, 8 Sep 2024 19:27:26 +0900 Subject: [PATCH 21/34] =?UTF-8?q?=E3=82=A8=E3=83=AA=E3=82=A2=E3=81=94?= =?UTF-8?q?=E3=81=A8=E3=81=AE=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E6=95=B0?= =?UTF-8?q?=E3=81=A7=E3=82=BD=E3=83=BC=E3=83=88=E3=81=97=E3=81=9F=E3=83=A6?= =?UTF-8?q?=E3=83=BC=E3=82=B6=E3=83=BC=E3=81=AE=E3=82=B0=E3=83=AB=E3=83=BC?= =?UTF-8?q?=E3=83=97=E3=82=92=E8=BF=94=E3=81=99=E3=83=A1=E3=82=BD=E3=83=83?= =?UTF-8?q?=E3=83=89=E3=82=92=E4=BF=AE=E6=AD=A3=20=20=20=20=20-=20?= =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E3=81=8C=E8=BF=94=E3=81=99?= =?UTF-8?q?=E3=81=AE=E3=81=AF=E3=82=A8=E3=83=AA=E3=82=A2=E3=81=94=E3=81=A8?= =?UTF-8?q?=E3=81=AB=E5=88=86=E3=81=91=E3=82=89=E3=82=8C=E3=81=9F=E3=80=8C?= =?UTF-8?q?=E8=A4=87=E6=95=B0=E3=81=AE=E3=82=B0=E3=83=AB=E3=83=BC=E3=83=97?= =?UTF-8?q?=E3=80=8D=E3=81=AE=E3=81=9F=E3=82=81=E3=80=81=E3=83=A1=E3=82=BD?= =?UTF-8?q?=E3=83=83=E3=83=89=E5=90=8D=E3=82=92=E3=82=8F=E3=81=8B=E3=82=8A?= =?UTF-8?q?=E3=82=84=E3=81=99=E3=81=8F=E4=BF=AE=E6=AD=A3=20=20=20=20=20-?= =?UTF-8?q?=20=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E5=90=8D=E3=81=AE?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E3=81=AB=E4=BC=B4=E3=81=84=E3=80=81=E3=83=86?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=82=92=E4=BF=AE=E6=AD=A3=20=20=20=20=20-?= =?UTF-8?q?=20=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E5=90=8D=E3=81=AE?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E3=81=AB=E4=BC=B4=E3=81=84=E3=80=81=E3=82=B3?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=83=AD=E3=83=BC=E3=83=A9=E3=83=BC=E3=81=8B?= =?UTF-8?q?=E3=82=89=E3=81=AE=E5=91=BC=E3=81=B3=E5=87=BA=E3=81=97=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20=20=20=20=20-=20=E3=83=A6=E3=83=BC?= =?UTF-8?q?=E3=82=B6=E3=83=BC=E5=8F=96=E5=BE=97=E6=99=82=E3=81=AB=E3=82=BD?= =?UTF-8?q?=E3=83=BC=E3=83=88=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users/areas_controller.rb | 2 +- app/models/area.rb | 10 +++++----- app/views/users/areas/index.html.slim | 8 ++++---- db/schema.rb | 9 +++++++++ test/models/area_test.rb | 4 ++-- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app/controllers/users/areas_controller.rb b/app/controllers/users/areas_controller.rb index 6e65292e06a..b7410adea30 100644 --- a/app/controllers/users/areas_controller.rb +++ b/app/controllers/users/areas_controller.rb @@ -3,7 +3,7 @@ class Users::AreasController < ApplicationController def index @number_of_users_by_region = Area.number_of_users_by_region - @users_group_by_areas = Kaminari.paginate_array(Area.sorted_users_group_by_areas).page(params[:page]).per(15) + @sorted_user_groups_by_area_user_num = Kaminari.paginate_array(Area.sorted_user_groups_by_area_user_num).page(params[:page]).per(15) end def show diff --git a/app/models/area.rb b/app/models/area.rb index b174e173021..60036637e0f 100644 --- a/app/models/area.rb +++ b/app/models/area.rb @@ -55,15 +55,15 @@ def number_of_users_by_region end end - def sorted_users_group_by_areas - users_group_by_areas = User.with_attached_avatar.all.group_by(&:area) + def sorted_user_groups_by_area_user_num + users_group_by_areas = User.with_attached_avatar.order(created_at: :desc).group_by(&:area) - sorted_users_group_by_areas = + sorted_users_group_by_non_nil_areas = users_group_by_areas.map do |area, users| - { users: users.sort_by(&:created_at).reverse, area: } unless area.nil? + { users:, area: } unless area.nil? end.compact - sorted_users_group_by_areas.sort_by { |hash| -hash[:users].size } + sorted_users_group_by_non_nil_areas.sort_by { |hash| -hash[:users].size } end private diff --git a/app/views/users/areas/index.html.slim b/app/views/users/areas/index.html.slim index db77b55a2cb..54836ec4f95 100644 --- a/app/views/users/areas/index.html.slim +++ b/app/views/users/areas/index.html.slim @@ -25,9 +25,9 @@ main.page-main .page-body__column.is-sub.is-sm = render 'areas_menu', number_of_users_by_region: @number_of_users_by_region .page-body__column.is-main - - if @users_group_by_areas.any? - = paginate @users_group_by_areas - - @users_group_by_areas.each do |users_group_by_area| + - if @sorted_user_groups_by_area_user_num.any? + = paginate @sorted_user_groups_by_area_user_num + - @sorted_user_groups_by_area_user_num.each do |users_group_by_area| section.a-card .user-group header.user-group__header @@ -39,6 +39,6 @@ main.page-main a.a-user-icons__item-link href=user.url span.a-user-role class="is-#{user.primary_role}" img.a-user-icons__item-icon.a-user-icon src=user.avatar_url title=user.icon_title data-login-name=user.login_name - = paginate @users_group_by_areas + = paginate @sorted_user_groups_by_area_user_num - else .empty-message 都道府県別ユーザー一覧はありません diff --git a/db/schema.rb b/db/schema.rb index 7e4afdd03c2..07635aa435b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -413,6 +413,14 @@ t.index ["survey_question_id"], name: "index_linear_scales_on_survey_question_id" end + create_table "micro_reports", force: :cascade do |t| + t.bigint "user_id", null: false + t.text "content", null: false + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["user_id"], name: "index_micro_reports_on_user_id" + end + create_table "notifications", force: :cascade do |t| t.integer "kind", default: 0, null: false t.bigint "user_id" @@ -814,6 +822,7 @@ add_foreign_key "learning_minute_statistics", "practices" add_foreign_key "learning_times", "reports" add_foreign_key "linear_scales", "survey_questions" + add_foreign_key "micro_reports", "users" add_foreign_key "notifications", "users" add_foreign_key "notifications", "users", column: "sender_id" add_foreign_key "organizers", "regular_events" diff --git a/test/models/area_test.rb b/test/models/area_test.rb index 9d474184109..30b2b9b3eb0 100644 --- a/test/models/area_test.rb +++ b/test/models/area_test.rb @@ -18,8 +18,8 @@ class AreaTest < ActiveSupport::TestCase } end - test '#sorted_users_group_by_areas' do - sorted_users_group_by_areas = Area.sorted_users_group_by_areas + test '#sorted_user_groups_by_area_user_num' do + sorted_users_group_by_areas = Area.sorted_user_groups_by_area_user_num tokyo_users = [users(:adminonly), users(:machida), users(:kimura)].sort_by(&:created_at).reverse tochigi_users = [users(:kyuukai)] nagasaki_users = [users(:advisernocolleguetrainee)] From 5c95c0b1e846f107e2692b54a91bf95961c00f1b Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sun, 8 Sep 2024 19:31:37 +0900 Subject: [PATCH 22/34] =?UTF-8?q?users=5Fby=5Fare=E3=83=A1=E3=82=BD?= =?UTF-8?q?=E3=83=83=E3=83=89=E3=82=92User=E3=83=A2=E3=83=87=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E3=81=AB=E7=A7=BB?= =?UTF-8?q?=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - user_by_areaメソッドはusersを返すためUserモデルに移動 - テストやコントローラを合わせて修正 --- app/controllers/users/areas_controller.rb | 2 +- app/models/area.rb | 10 ---------- app/models/user.rb | 10 ++++++++++ test/models/area_test.rb | 7 ------- test/models/user_test.rb | 7 +++++++ 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/controllers/users/areas_controller.rb b/app/controllers/users/areas_controller.rb index b7410adea30..0f6277a6781 100644 --- a/app/controllers/users/areas_controller.rb +++ b/app/controllers/users/areas_controller.rb @@ -8,7 +8,7 @@ def index def show @area = params[:area_name] - @users = Area.users_by_area(@area).page(params[:page]).per(15) + @users = User.users_by_area(@area).page(params[:page]).per(15) @number_of_users_by_region = Area.number_of_users_by_region end end diff --git a/app/models/area.rb b/app/models/area.rb index 60036637e0f..fdc12c0a6c1 100644 --- a/app/models/area.rb +++ b/app/models/area.rb @@ -19,16 +19,6 @@ class Area }.freeze class << self - def users_by_area(area) - subdivision = ISO3166::Country[:JP].find_subdivision_by_name(area) - return User.with_attached_avatar.where(subdivision_code: subdivision.code.to_s) if subdivision - - country = ISO3166::Country.find_country_by_any_name(area) - return User.with_attached_avatar.where(country_code: country.alpha2) if country - - User.none - end - # regionとareaによって分類されたユーザー数をハッシュで取得して返す関数 # country_codeかsubdivision_codeのどちらかがnullのユーザーのデータは無視されます # diff --git a/app/models/user.rb b/app/models/user.rb index a0c67d39c55..5b9476873f3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -493,6 +493,16 @@ def create_followup_comment(student) student.sent_student_followup_message = true student.save(validate: false) end + + def users_by_area(area) + subdivision = ISO3166::Country[:JP].find_subdivision_by_name(area) + return User.with_attached_avatar.where(subdivision_code: subdivision.code.to_s) if subdivision + + country = ISO3166::Country.find_country_by_any_name(area) + return User.with_attached_avatar.where(country_code: country.alpha2) if country + + User.none + end end def away? diff --git a/test/models/area_test.rb b/test/models/area_test.rb index 30b2b9b3eb0..317fb619067 100644 --- a/test/models/area_test.rb +++ b/test/models/area_test.rb @@ -3,13 +3,6 @@ require 'test_helper' class AreaTest < ActiveSupport::TestCase - test '#users_by_area' do - tokyo_users = [users(:adminonly), users(:machida), users(:kimura)] - assert_equal Area.users_by_area('東京都').to_a.sort, tokyo_users.sort - america_users = [users(:neverlogin), users(:tom)] - assert_equal Area.users_by_area('米国').to_a.sort, america_users.sort - end - test '#number_of_users_by_region' do assert_equal Area.number_of_users_by_region, { '関東地方' => { '東京都' => 3, '栃木県' => 1 }, diff --git a/test/models/user_test.rb b/test/models/user_test.rb index c4e5eb11cc4..eb159a639f7 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -739,4 +739,11 @@ class UserTest < ActiveSupport::TestCase assert_equal america_user.area, '米国' assert_equal no_area_user.area, nil end + + test '#users_by_area' do + tokyo_users = [users(:adminonly), users(:machida), users(:kimura)] + assert_equal User.users_by_area('東京都').to_a.sort, tokyo_users.sort + america_users = [users(:neverlogin), users(:tom)] + assert_equal User.users_by_area('米国').to_a.sort, america_users.sort + end end From 65ba4752235be6461baa7be88f3a2d3ffc7e2e8d Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sun, 8 Sep 2024 19:35:14 +0900 Subject: [PATCH 23/34] =?UTF-8?q?=E3=83=91=E3=83=A9=E3=83=A1=E3=83=BC?= =?UTF-8?q?=E3=82=BF=E5=90=8D=E3=82=92=E7=B0=A1=E6=BD=94=E3=81=AB=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users/areas_controller.rb | 2 +- app/views/users/areas/_areas_menu.html.slim | 2 +- app/views/users/areas/index.html.slim | 2 +- config/routes/users.rb | 2 +- test/system/user/areas_test.rb | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/users/areas_controller.rb b/app/controllers/users/areas_controller.rb index 0f6277a6781..ca7698738af 100644 --- a/app/controllers/users/areas_controller.rb +++ b/app/controllers/users/areas_controller.rb @@ -7,7 +7,7 @@ def index end def show - @area = params[:area_name] + @area = params[:area] @users = User.users_by_area(@area).page(params[:page]).per(15) @number_of_users_by_region = Area.number_of_users_by_region end diff --git a/app/views/users/areas/_areas_menu.html.slim b/app/views/users/areas/_areas_menu.html.slim index 37864ade521..5aec4b253b2 100644 --- a/app/views/users/areas/_areas_menu.html.slim +++ b/app/views/users/areas/_areas_menu.html.slim @@ -7,4 +7,4 @@ ul.page-nav__items - number_of_users_by_region[region].each do |area, number_of_users| li.page-nav__item - = link_to "#{area}(#{number_of_users})", users_area_path(area_name: area), class: 'page-nav__item-link a-text-link' + = link_to "#{area}(#{number_of_users})", users_area_path(area: area), class: 'page-nav__item-link a-text-link' diff --git a/app/views/users/areas/index.html.slim b/app/views/users/areas/index.html.slim index 54836ec4f95..9fc16aa5711 100644 --- a/app/views/users/areas/index.html.slim +++ b/app/views/users/areas/index.html.slim @@ -32,7 +32,7 @@ main.page-main .user-group header.user-group__header h2.user-group__title - = link_to users_group_by_area[:area], users_area_path(area_name: users_group_by_area[:area]), class: 'user-group__title-link' + = link_to users_group_by_area[:area], users_area_path(area: users_group_by_area[:area]), class: 'user-group__title-link' .a-user-icons .a-user-icons__items - users_group_by_area[:users].each do |user| diff --git a/config/routes/users.rb b/config/routes/users.rb index 28552c9ee8d..88061bb354a 100644 --- a/config/routes/users.rb +++ b/config/routes/users.rb @@ -6,7 +6,7 @@ get "tags", to: "tags#index" resources :companies, only: %i(index) resources :areas, only: %i(index) - get "areas/:area_name", to: "areas#show", as: :area + get "areas/:area", to: "areas#show", as: :area end resources :users, only: %i(index show new create) do diff --git a/test/system/user/areas_test.rb b/test/system/user/areas_test.rb index 345d2cb051b..430256082da 100644 --- a/test/system/user/areas_test.rb +++ b/test/system/user/areas_test.rb @@ -53,7 +53,7 @@ class User::AreasTest < ApplicationSystemTestCase end test 'show users by area' do - visit_with_auth users_area_path(area_name: '東京都'), 'kimura' + visit_with_auth users_area_path(area: '東京都'), 'kimura' assert_selector 'h1.page-main-header__title', text: '東京都' within '.page-body__column.is-main' do assert_selector '.users-item', count: 3 @@ -64,7 +64,7 @@ class User::AreasTest < ApplicationSystemTestCase end test 'show message when visit area with no one' do - visit_with_auth users_area_path(area_name: '茨城県'), 'kimura' + visit_with_auth users_area_path(area: '茨城県'), 'kimura' assert_selector 'h1.page-main-header__title', text: '茨城県' assert_text 'まだユーザーはいません' end From 157cca87df8caa455bd493c2cfd9d26c00e171fd Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Thu, 29 Aug 2024 11:39:30 +0900 Subject: [PATCH 24/34] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=81=AA=E3=83=AB?= =?UTF-8?q?=E3=83=BC=E3=83=86=E3=82=A3=E3=83=B3=E3=82=B0=E3=82=92=E5=89=8A?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes/api.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/config/routes/api.rb b/config/routes/api.rb index ba956040035..2c8d74d2400 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -33,7 +33,6 @@ resources :checks, only: %i(index create destroy) resources :mention_users, only: %i(index) namespace :users do - resources :areas, only: %i(index) resources :companies, only: %i(index) end resources :users, only: %i(index show update) From 92aea10efaad72c0ddbb4696e290dc7098c56085 Mon Sep 17 00:00:00 2001 From: machida Date: Fri, 30 Aug 2024 18:00:58 +0900 Subject: [PATCH 25/34] =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC?= =?UTF-8?q?=E3=82=B0=E3=83=AB=E3=83=BC=E3=83=97=E5=88=86=E3=81=91=E3=81=AE?= =?UTF-8?q?=E4=B8=80=E8=A6=A7=E3=81=AE=E3=82=AB=E3=83=BC=E3=83=89=E3=82=92?= =?UTF-8?q?=E5=88=A5=E3=80=85=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/blocks/user/_user-group.sass | 2 +- .../stylesheets/atoms/_a-user-icons.sass | 2 +- app/views/generations/index.html.slim | 8 ++--- app/views/tags/_tag.html.slim | 35 ++++++++++--------- app/views/users/areas/index.html.slim | 4 ++- app/views/users/tags/index.html.slim | 3 +- 6 files changed, 28 insertions(+), 26 deletions(-) diff --git a/app/javascript/stylesheets/application/blocks/user/_user-group.sass b/app/javascript/stylesheets/application/blocks/user/_user-group.sass index 7bc1d59fa53..31c7daf67d6 100644 --- a/app/javascript/stylesheets/application/blocks/user/_user-group.sass +++ b/app/javascript/stylesheets/application/blocks/user/_user-group.sass @@ -13,7 +13,7 @@ .user-group__title +media-breakpoint-up(md) - font-size: 1.125rem + font-size: 1rem +media-breakpoint-down(sm) font-size: 1rem diff --git a/app/javascript/stylesheets/atoms/_a-user-icons.sass b/app/javascript/stylesheets/atoms/_a-user-icons.sass index 484c165c806..bc5e0cc484e 100644 --- a/app/javascript/stylesheets/atoms/_a-user-icons.sass +++ b/app/javascript/stylesheets/atoms/_a-user-icons.sass @@ -1,7 +1,7 @@ .a-user-icons padding-top: .5rem margin-top: .75rem - border-top: dotted 1px var(--border-tint) + border-top: dashed 1px var(--border) margin-bottom: -.25rem .a-user-icons__items diff --git a/app/views/generations/index.html.slim b/app/views/generations/index.html.slim index ad185a90dc3..f39d90bd761 100644 --- a/app/views/generations/index.html.slim +++ b/app/views/generations/index.html.slim @@ -32,10 +32,10 @@ main.page-main | ユーザーはありません - else .container.is-lg - .card-list.a-card - - @generations.each do |generation| - - users = Generation.new(generation.number).target_users(@target) - - if !users.empty? + - @generations.each do |generation| + - users = Generation.new(generation.number).target_users(@target) + - if !users.empty? + .a-card .user-group header.user-group__header h2.user-group__title diff --git a/app/views/tags/_tag.html.slim b/app/views/tags/_tag.html.slim index 45bab5437f8..e1f24ccc25a 100644 --- a/app/views/tags/_tag.html.slim +++ b/app/views/tags/_tag.html.slim @@ -1,17 +1,18 @@ -.user-group class="#{users_tags_gradation(tag.count, @top3_tags_counts[0])}" - header.user-group__header - h2.user-group__title.is-inline - = link_to users_tag_path(tag.name), class: 'user-group__title-link' - - rank = users_tags_rank(tag.count, @top3_tags_counts) - - if rank.present? - span.user-group__title-icon(class="#{rank}") - i.fa-solid.fa-crown - span.user-group__title-label - | #{tag.name} - span.user-group__count - | (#{tag.count}) - .a-user-icons - .a-user-icons__items - = render partial: 'tags/user', - collection: User.desc_tagged_with(tag.name), - as: :user +.a-card + .user-group class="#{users_tags_gradation(tag.count, @top3_tags_counts[0])}" + header.user-group__header + h2.user-group__title.is-inline + = link_to users_tag_path(tag.name), class: 'user-group__title-link' + - rank = users_tags_rank(tag.count, @top3_tags_counts) + - if rank.present? + span.user-group__title-icon(class="#{rank}") + i.fa-solid.fa-crown + span.user-group__title-label + | #{tag.name} + span.user-group__count + | (#{tag.count}) + .a-user-icons + .a-user-icons__items + = render partial: 'tags/user', + collection: User.desc_tagged_with(tag.name), + as: :user diff --git a/app/views/users/areas/index.html.slim b/app/views/users/areas/index.html.slim index 9fc16aa5711..549b9f8b784 100644 --- a/app/views/users/areas/index.html.slim +++ b/app/views/users/areas/index.html.slim @@ -32,7 +32,9 @@ main.page-main .user-group header.user-group__header h2.user-group__title - = link_to users_group_by_area[:area], users_area_path(area: users_group_by_area[:area]), class: 'user-group__title-link' + = link_to users_area_path(area_name: users_group_by_area[:area]), class: 'user-group__title-link' do + span.user-group__title-label + = users_group_by_area[:area] .a-user-icons .a-user-icons__items - users_group_by_area[:users].each do |user| diff --git a/app/views/users/tags/index.html.slim b/app/views/users/tags/index.html.slim index 303d8d5e323..0680495fe10 100644 --- a/app/views/users/tags/index.html.slim +++ b/app/views/users/tags/index.html.slim @@ -22,8 +22,7 @@ main.page-main .container.is-lg - if @tags.present? = paginate @tags - .a-card - = render partial: 'tags/tag', collection: @tags, as: :tag + = render partial: 'tags/tag', collection: @tags, as: :tag = paginate @tags - else .o-empty-message From 8267465a95aa40e51b2bb0f4c511fd23f65bf89c Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sun, 8 Sep 2024 22:54:48 +0900 Subject: [PATCH 26/34] =?UTF-8?q?=E3=83=91=E3=83=A9=E3=83=A1=E3=83=BC?= =?UTF-8?q?=E3=82=BF=E5=90=8D=E3=81=AE=E4=BF=AE=E6=AD=A3=E6=BC=8F=E3=82=8C?= =?UTF-8?q?=E3=82=92=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/areas/index.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/areas/index.html.slim b/app/views/users/areas/index.html.slim index 549b9f8b784..60a9e36f4eb 100644 --- a/app/views/users/areas/index.html.slim +++ b/app/views/users/areas/index.html.slim @@ -32,7 +32,7 @@ main.page-main .user-group header.user-group__header h2.user-group__title - = link_to users_area_path(area_name: users_group_by_area[:area]), class: 'user-group__title-link' do + = link_to users_area_path(area: users_group_by_area[:area]), class: 'user-group__title-link' do span.user-group__title-label = users_group_by_area[:area] .a-user-icons From 49f1b0ff276a3cc0e22feae00d77308a7f92242a Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Tue, 10 Sep 2024 23:12:38 +0900 Subject: [PATCH 27/34] =?UTF-8?q?=E7=9C=81=E7=95=A5=E5=BD=A2=E3=81=AB?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/areas/_areas_menu.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/areas/_areas_menu.html.slim b/app/views/users/areas/_areas_menu.html.slim index 5aec4b253b2..1f496ff5fdc 100644 --- a/app/views/users/areas/_areas_menu.html.slim +++ b/app/views/users/areas/_areas_menu.html.slim @@ -7,4 +7,4 @@ ul.page-nav__items - number_of_users_by_region[region].each do |area, number_of_users| li.page-nav__item - = link_to "#{area}(#{number_of_users})", users_area_path(area: area), class: 'page-nav__item-link a-text-link' + = link_to "#{area}(#{number_of_users})", users_area_path(area:), class: 'page-nav__item-link a-text-link' From ec163fdd711b102a23b4eac27ac198e4b41702c8 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Tue, 10 Sep 2024 23:15:25 +0900 Subject: [PATCH 28/34] =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89?= =?UTF-8?q?=E5=90=8D=E3=81=8C=E7=B0=A1=E6=BD=94=E3=81=AB=E3=81=AA=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users/areas_controller.rb | 2 +- app/models/user.rb | 2 +- test/models/user_test.rb | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/users/areas_controller.rb b/app/controllers/users/areas_controller.rb index ca7698738af..094689e0ea4 100644 --- a/app/controllers/users/areas_controller.rb +++ b/app/controllers/users/areas_controller.rb @@ -8,7 +8,7 @@ def index def show @area = params[:area] - @users = User.users_by_area(@area).page(params[:page]).per(15) + @users = User.by_area(@area).page(params[:page]).per(15) @number_of_users_by_region = Area.number_of_users_by_region end end diff --git a/app/models/user.rb b/app/models/user.rb index 5b9476873f3..98d3f2a1be6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -494,7 +494,7 @@ def create_followup_comment(student) student.save(validate: false) end - def users_by_area(area) + def by_area(area) subdivision = ISO3166::Country[:JP].find_subdivision_by_name(area) return User.with_attached_avatar.where(subdivision_code: subdivision.code.to_s) if subdivision diff --git a/test/models/user_test.rb b/test/models/user_test.rb index eb159a639f7..0c5ba89ae73 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -740,10 +740,10 @@ class UserTest < ActiveSupport::TestCase assert_equal no_area_user.area, nil end - test '#users_by_area' do + test '#by_area' do tokyo_users = [users(:adminonly), users(:machida), users(:kimura)] - assert_equal User.users_by_area('東京都').to_a.sort, tokyo_users.sort + assert_equal User.by_area('東京都').to_a.sort, tokyo_users.sort america_users = [users(:neverlogin), users(:tom)] - assert_equal User.users_by_area('米国').to_a.sort, america_users.sort + assert_equal User.by_area('米国').to_a.sort, america_users.sort end end From 6b39ba166c619be6ecc83f29cb6469ca44188958 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Fri, 13 Sep 2024 18:11:11 +0900 Subject: [PATCH 29/34] =?UTF-8?q?=E3=83=9E=E3=82=B8=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=83=8A=E3=83=B3=E3=83=90=E3=83=BC=E3=82=92=E5=AE=9A=E6=95=B0?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users/areas_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/users/areas_controller.rb b/app/controllers/users/areas_controller.rb index 094689e0ea4..b67ec68df6b 100644 --- a/app/controllers/users/areas_controller.rb +++ b/app/controllers/users/areas_controller.rb @@ -1,14 +1,16 @@ # frozen_string_literal: true class Users::AreasController < ApplicationController + PAGER_NUMBER = 15 + def index @number_of_users_by_region = Area.number_of_users_by_region - @sorted_user_groups_by_area_user_num = Kaminari.paginate_array(Area.sorted_user_groups_by_area_user_num).page(params[:page]).per(15) + @sorted_user_groups_by_area_user_num = Kaminari.paginate_array(Area.sorted_user_groups_by_area_user_num).page(params[:page]).per(PAGER_NUMBER) end def show @area = params[:area] - @users = User.by_area(@area).page(params[:page]).per(15) + @users = User.by_area(@area).page(params[:page]).per(PAGER_NUMBER) @number_of_users_by_region = Area.number_of_users_by_region end end From 872b14ae8d405ddeea1647253415e0df15e749b3 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Fri, 13 Sep 2024 18:13:35 +0900 Subject: [PATCH 30/34] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E5=90=8D?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/models/user_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/models/user_test.rb b/test/models/user_test.rb index 0c5ba89ae73..22460b338ee 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -731,7 +731,7 @@ class UserTest < ActiveSupport::TestCase assert_equal User.all, User.users_job('destroy_all') end - test 'area' do + test '#area' do tokyo_user = users(:machida) america_user = users(:tom) no_area_user = users(:komagata) From 0f7441e0531ee7ce80804725b72e9f4e12ee2003 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Mon, 23 Sep 2024 21:48:23 +0900 Subject: [PATCH 31/34] =?UTF-8?q?=E3=82=B3=E3=83=AC=E3=82=AF=E3=82=B7?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=81=AE=E3=83=AC=E3=83=B3=E3=83=80=E3=83=BC?= =?UTF-8?q?=E3=82=92=E4=B8=80=E6=8B=AC=E3=81=A7=E8=A1=8C=E3=81=86=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/areas/_user_list.html.slim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/users/areas/_user_list.html.slim b/app/views/users/areas/_user_list.html.slim index d4be51ecdbf..280e00daf21 100644 --- a/app/views/users/areas/_user_list.html.slim +++ b/app/views/users/areas/_user_list.html.slim @@ -2,8 +2,7 @@ .user-list = paginate users .row - - users.each do |user| - = render 'users/user', user: + = render partial: 'users/user', collection: users = paginate users - else .row From 89183297cc8508e4321a88fdf90f7b882406824c Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Mon, 23 Sep 2024 22:53:04 +0900 Subject: [PATCH 32/34] =?UTF-8?q?=E3=83=96=E3=83=AD=E3=83=83=E3=82=AF?= =?UTF-8?q?=E5=A4=89=E6=95=B0=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97=E3=80=81?= =?UTF-8?q?number=5Fof=5Fusers=5Fby=5Fregion=E3=81=B8=E3=81=AE=E4=B8=8D?= =?UTF-8?q?=E8=A6=81=E3=81=AA=E3=82=A2=E3=82=AF=E3=82=BB=E3=82=B9=E3=82=92?= =?UTF-8?q?=E5=BB=83=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/areas/_areas_menu.html.slim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/users/areas/_areas_menu.html.slim b/app/views/users/areas/_areas_menu.html.slim index 1f496ff5fdc..27d010b393e 100644 --- a/app/views/users/areas/_areas_menu.html.slim +++ b/app/views/users/areas/_areas_menu.html.slim @@ -1,10 +1,10 @@ -- number_of_users_by_region.each do |region, _| +- number_of_users_by_region.each do |region, number_of_users_by_area| nav.page-nav.a-card header.page-nav__header h2.page-nav__title span.page-nav__title-inner = region hr.a-border-tint ul.page-nav__items - - number_of_users_by_region[region].each do |area, number_of_users| + - number_of_users_by_area.each do |area, number_of_users| li.page-nav__item = link_to "#{area}(#{number_of_users})", users_area_path(area:), class: 'page-nav__item-link a-text-link' From b1a3e89e3312dbfbb152d13a16ba0dddd95240a5 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Sat, 28 Sep 2024 16:56:23 +0900 Subject: [PATCH 33/34] =?UTF-8?q?=E3=82=BF=E3=83=96=E3=82=92Tab=20Componen?= =?UTF-8?q?t=E3=81=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/areas/show.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/areas/show.html.slim b/app/views/users/areas/show.html.slim index 757a9f45d49..81e70042188 100644 --- a/app/views/users/areas/show.html.slim +++ b/app/views/users/areas/show.html.slim @@ -7,7 +7,7 @@ header.page-header .page-header__start h2.page-header__title ユーザー一覧 -= render '/users/lg_page_tabs' += users_page_tabs(active_tab: '都道府県別') main.page-main header.page-main-header From 8c00ccd4347ba1856d7c926f0b59840c8b9a59b9 Mon Sep 17 00:00:00 2001 From: Kuroneko Date: Wed, 2 Oct 2024 09:31:55 +0900 Subject: [PATCH 34/34] =?UTF-8?q?=E3=82=AF=E3=83=A9=E3=82=B9=E3=83=A1?= =?UTF-8?q?=E3=82=BD=E3=83=83=E3=83=89=E3=81=AE=E3=83=86=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=81=AE=E3=81=9F=E3=82=81=E3=80=81=E5=91=BD=E5=90=8D=E3=82=92?= =?UTF-8?q?=E3=80=8C.=E3=80=8D=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/models/user_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/models/user_test.rb b/test/models/user_test.rb index 22460b338ee..534cd756b3c 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -740,7 +740,7 @@ class UserTest < ActiveSupport::TestCase assert_equal no_area_user.area, nil end - test '#by_area' do + test '.by_area' do tokyo_users = [users(:adminonly), users(:machida), users(:kimura)] assert_equal User.by_area('東京都').to_a.sort, tokyo_users.sort america_users = [users(:neverlogin), users(:tom)]