From 48558dd227b91624d84e19abada3a3c4ac8c76c0 Mon Sep 17 00:00:00 2001 From: omochiumaiumai Date: Mon, 9 Oct 2023 16:36:46 +0900 Subject: [PATCH 01/12] =?UTF-8?q?=E4=BC=91=E4=BC=9A=E6=97=A5=E6=95=B0?= =?UTF-8?q?=E3=81=AE=E9=A0=85=E7=9B=AE=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/_hibernation_info.html.slim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/views/users/_hibernation_info.html.slim b/app/views/users/_hibernation_info.html.slim index 82b5b5279dd..c6d6d6a6039 100644 --- a/app/views/users/_hibernation_info.html.slim +++ b/app/views/users/_hibernation_info.html.slim @@ -6,6 +6,13 @@ .user-metas__item-label 最後に休会した日時 .user-metas__item-value = l user.hibernated_at + .user-metas__item + .user-metas__item-label 休会日数 + .user-metas__item-value + | 休会から + strong + = (Time.current.to_date - user.hibernated_at.to_date).to_i + | 日目 - user.hibernations.each_with_index do |hibernation, i| - number = i + 1 .user-metas__items From b2b5831ee44ff04f00f394c09b6a46209d91d9cc Mon Sep 17 00:00:00 2001 From: omochiumaiumai Date: Mon, 9 Oct 2023 18:17:12 +0900 Subject: [PATCH 02/12] =?UTF-8?q?=E4=BC=91=E4=BC=9A=E6=97=A5=E6=95=B0?= =?UTF-8?q?=E3=81=AE=E9=A0=85=E7=9B=AE=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/_hibernation_info.html.slim | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/views/users/_hibernation_info.html.slim b/app/views/users/_hibernation_info.html.slim index c6d6d6a6039..82b5b5279dd 100644 --- a/app/views/users/_hibernation_info.html.slim +++ b/app/views/users/_hibernation_info.html.slim @@ -6,13 +6,6 @@ .user-metas__item-label 最後に休会した日時 .user-metas__item-value = l user.hibernated_at - .user-metas__item - .user-metas__item-label 休会日数 - .user-metas__item-value - | 休会から - strong - = (Time.current.to_date - user.hibernated_at.to_date).to_i - | 日目 - user.hibernations.each_with_index do |hibernation, i| - number = i + 1 .user-metas__items From 2b93a2cff32bc72d37988925cb6a3baf247f8c6e Mon Sep 17 00:00:00 2001 From: omochiumaiumai Date: Mon, 9 Oct 2023 18:20:15 +0900 Subject: [PATCH 03/12] =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC?= =?UTF-8?q?=E3=81=8C=E4=BC=91=E4=BC=9A=E4=B8=AD=E3=81=AE=E5=A0=B4=E5=90=88?= =?UTF-8?q?=E3=80=81=E4=BC=91=E4=BC=9A=E6=97=A5=E6=95=B0=E3=82=92=E3=80=8C?= =?UTF-8?q?=E5=8C=BA=E5=88=86=E3=80=8D=E3=81=AE=E9=A0=85=E7=9B=AE=E3=81=AB?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_hibernation_status.html.slim | 5 +++++ app/views/users/_metas.html.slim | 1 + 2 files changed, 6 insertions(+) create mode 100644 app/views/users/_hibernation_status.html.slim diff --git a/app/views/users/_hibernation_status.html.slim b/app/views/users/_hibernation_status.html.slim new file mode 100644 index 00000000000..ee6ea122ebf --- /dev/null +++ b/app/views/users/_hibernation_status.html.slim @@ -0,0 +1,5 @@ +- if user.hibernated? + | / 休会から + strong + = "#{(Time.current.to_date - user.hibernated_at.to_date).to_i}" + | 日目 diff --git a/app/views/users/_metas.html.slim b/app/views/users/_metas.html.slim index edce6a1d3d7..184879445d5 100644 --- a/app/views/users/_metas.html.slim +++ b/app/views/users/_metas.html.slim @@ -54,6 +54,7 @@ - user.roles.each do |role| li = t "target.#{role}" + = render 'users/hibernation_status', user: user - if user.trainee? && user.training_ends_on? .user-metas__item .user-metas__item-label From ef7830e13a2d29740340f99b37ea3936307df0ed Mon Sep 17 00:00:00 2001 From: omochiumaiumai Date: Mon, 9 Oct 2023 18:48:40 +0900 Subject: [PATCH 04/12] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=81=AA=E6=96=87?= =?UTF-8?q?=E5=AD=97=E5=88=97=E3=81=B8=E3=81=AE=E5=A4=89=E6=8F=9B=E3=82=92?= =?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/_hibernation_status.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_hibernation_status.html.slim b/app/views/users/_hibernation_status.html.slim index ee6ea122ebf..28c713a8f98 100644 --- a/app/views/users/_hibernation_status.html.slim +++ b/app/views/users/_hibernation_status.html.slim @@ -1,5 +1,5 @@ - if user.hibernated? | / 休会から strong - = "#{(Time.current.to_date - user.hibernated_at.to_date).to_i}" + = (Time.current.to_date - user.hibernated_at.to_date).to_i | 日目 From 593b8a4ea77b38706e8666ad1d466e4704f3c569 Mon Sep 17 00:00:00 2001 From: omochiumaiumai Date: Tue, 10 Oct 2023 16:03:15 +0900 Subject: [PATCH 05/12] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/system/users_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/system/users_test.rb b/test/system/users_test.rb index 039063b70e0..0256677daa1 100644 --- a/test/system/users_test.rb +++ b/test/system/users_test.rb @@ -617,4 +617,13 @@ class UsersTest < ApplicationSystemTestCase click_link('アドバイザー') assert_no_selector '.card-counts__items' end + + test 'show hibernation period in profile' do + visit_with_auth "/users/#{users(:kyuukai).id}", 'komagata' + assert_text '休会中' + assert_text '休会から' + visit_with_auth "/users/#{users(:hatsuno).id}", 'komagata' + assert_no_text '休会中' + assert_no_text '休会から' + end end From fca3f345a6a370525ce5792b9c2c654fd4c4a70f Mon Sep 17 00:00:00 2001 From: omochiumaiumai Date: Sun, 15 Oct 2023 16:23:50 +0900 Subject: [PATCH 06/12] =?UTF-8?q?=E3=83=87=E3=82=B3=E3=83=AC=E3=83=BC?= =?UTF-8?q?=E3=82=BF=E3=83=BC=E3=81=AB=E4=BC=91=E4=BC=9A=E6=9C=9F=E9=96=93?= =?UTF-8?q?=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=83=A1=E3=82=BD?= =?UTF-8?q?=E3=83=83=E3=83=89=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/decorators/user_decorator.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index 1dbe776f5c5..713979a5eb4 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -120,4 +120,8 @@ def address country_name end end + + def hibernation_period + " / 休会から#{(Time.current.to_date - hibernated_at.to_date).to_i}日目" + end end From d13b36b9182d125b8b366e2e13f7cb79aac2074b Mon Sep 17 00:00:00 2001 From: omochiumaiumai Date: Sun, 15 Oct 2023 16:29:53 +0900 Subject: [PATCH 07/12] =?UTF-8?q?=E4=BC=91=E4=BC=9A=E6=9C=9F=E9=96=93?= =?UTF-8?q?=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=20/=20=E3=83=91=E3=83=BC=E3=82=B7?= =?UTF-8?q?=E3=83=A3=E3=83=AB=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/_hibernation_status.html.slim | 5 ----- app/views/users/_metas.html.slim | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 app/views/users/_hibernation_status.html.slim diff --git a/app/views/users/_hibernation_status.html.slim b/app/views/users/_hibernation_status.html.slim deleted file mode 100644 index 28c713a8f98..00000000000 --- a/app/views/users/_hibernation_status.html.slim +++ /dev/null @@ -1,5 +0,0 @@ -- if user.hibernated? - | / 休会から - strong - = (Time.current.to_date - user.hibernated_at.to_date).to_i - | 日目 diff --git a/app/views/users/_metas.html.slim b/app/views/users/_metas.html.slim index 184879445d5..63134ae240e 100644 --- a/app/views/users/_metas.html.slim +++ b/app/views/users/_metas.html.slim @@ -54,7 +54,7 @@ - user.roles.each do |role| li = t "target.#{role}" - = render 'users/hibernation_status', user: user + = user.hibernation_period if role == "hibernationed" - if user.trainee? && user.training_ends_on? .user-metas__item .user-metas__item-label From 223399018210bee5ecc254a6d5fb7d33961e88fc Mon Sep 17 00:00:00 2001 From: omochiumaiumai Date: Sun, 15 Oct 2023 17:18:31 +0900 Subject: [PATCH 08/12] =?UTF-8?q?=E4=BC=91=E4=BC=9A=E6=97=A5=E6=95=B0?= =?UTF-8?q?=E3=81=AE=E3=83=86=E3=82=B9=E3=83=88=E3=82=92=E8=BF=BD=E8=A8=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/system/users_test.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/system/users_test.rb b/test/system/users_test.rb index 0256677daa1..365ad8f6143 100644 --- a/test/system/users_test.rb +++ b/test/system/users_test.rb @@ -619,9 +619,11 @@ class UsersTest < ApplicationSystemTestCase end test 'show hibernation period in profile' do - visit_with_auth "/users/#{users(:kyuukai).id}", 'komagata' - assert_text '休会中' - assert_text '休会から' + travel_to Time.zone.local(2023, 10, 15) do + visit_with_auth "/users/#{users(:kyuukai).id}", 'komagata' + assert_text '休会中' + assert_text '休会から1383日目' + end visit_with_auth "/users/#{users(:hatsuno).id}", 'komagata' assert_no_text '休会中' assert_no_text '休会から' From 73ca7ebeb50f6dc3e995f1bb5b31264a0f65d577 Mon Sep 17 00:00:00 2001 From: omochiumaiumai Date: Sun, 15 Oct 2023 17:34:57 +0900 Subject: [PATCH 09/12] =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=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/decorators/user_decorator.rb | 4 ---- app/views/users/_metas.html.slim | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index 713979a5eb4..1dbe776f5c5 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -120,8 +120,4 @@ def address country_name end end - - def hibernation_period - " / 休会から#{(Time.current.to_date - hibernated_at.to_date).to_i}日目" - end end diff --git a/app/views/users/_metas.html.slim b/app/views/users/_metas.html.slim index 63134ae240e..39259068c13 100644 --- a/app/views/users/_metas.html.slim +++ b/app/views/users/_metas.html.slim @@ -54,7 +54,7 @@ - user.roles.each do |role| li = t "target.#{role}" - = user.hibernation_period if role == "hibernationed" + = " / 休会から#{(Time.current.to_date - user.hibernated_at.to_date).to_i}日目" if role == "hibernationed" - if user.trainee? && user.training_ends_on? .user-metas__item .user-metas__item-label From 067a5415f286f979b9eea2eb4f26a27a843587ca Mon Sep 17 00:00:00 2001 From: omochiumaiumai Date: Sun, 15 Oct 2023 17:51:36 +0900 Subject: [PATCH 10/12] =?UTF-8?q?=E3=82=B7=E3=83=B3=E3=82=B0=E3=83=AB?= =?UTF-8?q?=E3=82=AF=E3=82=A9=E3=83=BC=E3=83=88=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/_metas.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_metas.html.slim b/app/views/users/_metas.html.slim index 39259068c13..9bb0e45bfae 100644 --- a/app/views/users/_metas.html.slim +++ b/app/views/users/_metas.html.slim @@ -54,7 +54,7 @@ - user.roles.each do |role| li = t "target.#{role}" - = " / 休会から#{(Time.current.to_date - user.hibernated_at.to_date).to_i}日目" if role == "hibernationed" + = " / 休会から#{(Time.current.to_date - user.hibernated_at.to_date).to_i}日目" if role == 'hibernationed' - if user.trainee? && user.training_ends_on? .user-metas__item .user-metas__item-label From a4b9b330384b41f130c6351c6e9b7aa56c2d0bf2 Mon Sep 17 00:00:00 2001 From: omochiumaiumai Date: Sun, 15 Oct 2023 18:09:56 +0900 Subject: [PATCH 11/12] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/system/users_test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/system/users_test.rb b/test/system/users_test.rb index 365ad8f6143..ef87b613797 100644 --- a/test/system/users_test.rb +++ b/test/system/users_test.rb @@ -620,9 +620,10 @@ class UsersTest < ApplicationSystemTestCase test 'show hibernation period in profile' do travel_to Time.zone.local(2023, 10, 15) do + hibernation_period = 1383 visit_with_auth "/users/#{users(:kyuukai).id}", 'komagata' assert_text '休会中' - assert_text '休会から1383日目' + assert_text "休会から#{hibernation_period}日目" end visit_with_auth "/users/#{users(:hatsuno).id}", 'komagata' assert_no_text '休会中' From 600bac3db852ee2a0f1c459605de382564eaa291 Mon Sep 17 00:00:00 2001 From: omochiumaiumai Date: Sun, 15 Oct 2023 23:43:17 +0900 Subject: [PATCH 12/12] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/system/users_test.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/system/users_test.rb b/test/system/users_test.rb index ef87b613797..589349354a3 100644 --- a/test/system/users_test.rb +++ b/test/system/users_test.rb @@ -619,14 +619,14 @@ class UsersTest < ApplicationSystemTestCase end test 'show hibernation period in profile' do - travel_to Time.zone.local(2023, 10, 15) do - hibernation_period = 1383 - visit_with_auth "/users/#{users(:kyuukai).id}", 'komagata' - assert_text '休会中' - assert_text "休会から#{hibernation_period}日目" + hibernated_user = users(:kyuukai) + user = users(:hatsuno) + + travel_to hibernated_user.hibernated_at + 30.days do + visit_with_auth user_path(hibernated_user), 'komagata' + assert_text '休会中 / 休会から30日目' end - visit_with_auth "/users/#{users(:hatsuno).id}", 'komagata' - assert_no_text '休会中' - assert_no_text '休会から' + visit_with_auth user_path(user), 'komagata' + assert_no_text '休会中 / 休会から' end end