Skip to content

Commit

Permalink
Merge pull request #8023 from fjordllc/bug/fix-users-by-generation
Browse files Browse the repository at this point in the history
期生別のユーザー人数で現役生がマイナス人数になっているのを修正
  • Loading branch information
komagata authored Aug 20, 2024
2 parents bd49ba8 + 0176f43 commit 213c7b5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions app/models/generation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ def target_users(target)
end

def count_classmates_by_target(target)
return classmates.students.count - classmates.hibernated.count if target == :students

classmates.send(target).count
end
end
2 changes: 1 addition & 1 deletion test/models/generation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class GenerationTest < ActiveSupport::TestCase
end

test '#count_classmates_by_target' do
assert_equal 13, Generation.new(5).count_classmates_by_target(:students)
assert_equal 14, Generation.new(5).count_classmates_by_target(:students)
assert_equal 3, Generation.new(5).count_classmates_by_target(:trainees)
assert_equal 1, Generation.new(5).count_classmates_by_target(:hibernated)
assert_equal 2, Generation.new(5).count_classmates_by_target(:graduated)
Expand Down
2 changes: 1 addition & 1 deletion test/system/generations_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class GenerationsTest < ApplicationSystemTestCase
assert_link '5期生'
assert_text '2014年01月01日 ~ 2014年03月31日'
assert_text '現役生'
assert_selector '.card-counts__item-value', text: '13'
assert_selector '.card-counts__item-value', text: '14'
assert_text '研修生'
assert_selector '.card-counts__item-value', text: '3'
assert_text '休会'
Expand Down

0 comments on commit 213c7b5

Please sign in to comment.