Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

「自分の担当」タブのバッチに表示される件数が0件の場合はバッチを表示しないように実装 #3624

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/views/products/_tabs.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
li.page-tabs__item.is-only-mentor
= link_to products_self_assigned_index_path, class: "page-tabs__item-link #{current_link(/^products-self_assigned-index/)}" do
| 自分の担当 (#{Product.self_assigned_product(current_user.id).size})
.page-tabs__item-count.a-notification-count.is-only-mentor
= Cache.self_assigned_no_replied_product_count(current_user.id)
- if Cache.self_assigned_no_replied_product_count(current_user.id).positive?
.page-tabs__item-count.a-notification-count.is-only-mentor
= Cache.self_assigned_no_replied_product_count(current_user.id)
9 changes: 4 additions & 5 deletions test/system/products_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -297,21 +297,20 @@ class ProductsTest < ApplicationSystemTestCase
test 'be person on charge at comment on product of there are not person on charge' do
visit_with_auth products_not_responded_index_path, 'machida'
def assigned_product_count
find_link('自分の担当').find('.page-tabs__item-count').text.to_i
text[/自分の担当 ((\d+))/, 1].to_i
end

before_comment = assigned_product_count

[
'担当者がいない提出物の場合、担当者になる',
'自分が担当者の場合、担当者のまま',
'タブ上の数字は未返信の数字のため、返信するとカウントされない'
'自分が担当者の場合、担当者のまま'
].each do |comment|
visit "/products/#{products(:product1).id}"
post_comment(comment)

visit products_not_responded_index_path
assert_equal before_comment, assigned_product_count
assert_equal before_comment + 1, assigned_product_count
end
end

Expand All @@ -325,7 +324,7 @@ def assigned_product_count
visit_with_auth products_not_responded_index_path, 'machida'

def assigned_product_count
find_link('自分の担当').find('.page-tabs__item-count').text.to_i
text[/自分の担当 ((\d+))/, 1].to_i
end

before_comment = assigned_product_count
Expand Down