Skip to content

Commit

Permalink
Merge pull request #7843 from fjordllc/feature/display-message-in-rep…
Browse files Browse the repository at this point in the history
…ort-of-retired-user

管理者・メンターが退会者の日報をみた時に、退会者の日報であることをメッセージで表示する
  • Loading branch information
komagata authored Jun 24, 2024
2 parents 6f436ce + dbfdc16 commit 206c9b4
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 10 deletions.
21 changes: 13 additions & 8 deletions app/views/reports/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
= render 'users/page_title', user: @report.user
= render 'users/page_tabs', user: @report.user

- if mentor_login? && [email protected]? && @report.latest_of_user?
.a-page-notice.is-only-mentor(class="#{@report.interval >= 10 ? 'is-danger' : ''}")
.container
.a-page-notice__inner
p
strong
| #{@report.interval}
| ぶりの日報です
- if admin_or_mentor_login?
- if @report.user.retired_on?
.a-page-notice.is-muted.is-only-mentor
.container
.a-page-notice__inner
p このユーザーは退会しています。
- elsif [email protected]? && @report.latest_of_user?
.a-page-notice.is-only-mentor(class="#{@report.interval >= 10 ? 'is-danger' : ''}")
.container
.a-page-notice__inner
p
strong #{@report.interval}
| ぶりの日報です。

.page-body
.container.is-xxl
Expand Down
16 changes: 16 additions & 0 deletions db/fixtures/reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,19 @@ report<%= i + 71 %>:
MaruMaru Inc.で研修をしました。
reported_on: <%= Time.now - 1.month + i.day %>
<% end %>

report87:
user: yameo
title: "退会済みユーザーの日報1"
emotion: 1
description: |-
なかなか頑張れていない
reported_on: <%= Time.now - 1.month - 11.day %>

report88:
user: yameo
title: "退会済みユーザーの日報2"
emotion: 1
description: |-
お世話になりました
reported_on: <%= Time.now - 1.month - 1.day %>
19 changes: 17 additions & 2 deletions test/system/reports_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -546,14 +546,14 @@ def wait_for_watch_change

test 'display report interval for mentor while undoing wip' do
visit_with_auth report_path(reports(:report32)), 'komagata'
assert_selector '.a-page-notice.is-only-mentor.is-danger', text: '10日ぶりの日報です'
assert_selector '.a-page-notice.is-only-mentor.is-danger', text: '10日ぶりの日報です'

visit_with_auth report_path(reports(:report33)), 'kananashi'
click_link '内容修正'
click_button '提出'

visit_with_auth report_path(reports(:report32)), 'komagata'
assert_no_selector '.a-page-notice.is-only-mentor.is-danger', text: '9日ぶりの日報です'
assert_no_selector '.a-page-notice.is-only-mentor.is-danger', text: '9日ぶりの日報です'
end

test 'notify to chat after create a report' do
Expand Down Expand Up @@ -754,4 +754,19 @@ def wait_for_watch_change
assert_no_text 'この日報はすでに提出済みです。'
assert_button '提出'
end

test 'display message to admin or mentor in report of retired user' do
report = Report.create!(
user: users(:yameo),
title: '退会済みユーザーの日報',
reported_on: '2022-01-03',
emotion: 'happy',
no_learn: true,
wip: false,
description: 'お世話になりました'
)

visit_with_auth report_path(report), 'komagata'
assert_selector '.a-page-notice.is-muted.is-only-mentor', text: 'このユーザーは退会しています。'
end
end

0 comments on commit 206c9b4

Please sign in to comment.