Skip to content

Commit

Permalink
Merge pull request #3441 from fjordllc/feature/remove-paging-for-unas…
Browse files Browse the repository at this point in the history
…signed-submissions

未アサインの提出物のページングを削除
  • Loading branch information
komagata authored Oct 26, 2021
2 parents 5ce8b48 + 62f74c4 commit 6a884a6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
1 change: 0 additions & 1 deletion app/controllers/api/products/unassigned_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def index
.not_wip
.list
.order_for_not_wip_list
.page(params[:page])
@latest_product_submitted_just_5days = @products.find { |product| product.elapsed_days == 5 }
@latest_product_submitted_just_6days = @products.find { |product| product.elapsed_days == 6 }
@latest_product_submitted_over_7days = @products.find { |product| product.elapsed_days >= 7 }
Expand Down
2 changes: 1 addition & 1 deletion app/views/api/products/unassigned/index.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ json.products do
json.partial! "api/products/product", product: product
end
end
json.total_pages @products.page(1).total_pages
json.total_pages 1
json.latest_product_submitted_just_5days @latest_product_submitted_just_5days
json.latest_product_submitted_just_6days @latest_product_submitted_just_6days
json.latest_product_submitted_over_7days @latest_product_submitted_over_7days
4 changes: 0 additions & 4 deletions test/system/product/unassigned_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
require 'application_system_test_case'

class ProductsTest < ApplicationSystemTestCase
PAGINATES_PER = 50

test 'non-staff user can not see listing unassigned products' do
visit_with_auth '/products/unassigned', 'hatsuno'
assert_text '管理者・アドバイザー・メンターとしてログインしてください'
Expand Down Expand Up @@ -39,8 +37,6 @@ class ProductsTest < ApplicationSystemTestCase
test 'products order on unassigned tab' do
# id順で並べたときの最初と最後の提出物を、提出日順で見たときに最新と最古になるように入れ替える
Product.update_all(created_at: 1.day.ago, published_at: 1.day.ago) # rubocop:disable Rails/SkipsModelValidations
# 最古の提出物を画面上で判定するため、提出物を1ページ内に収める
Product.unassigned.unchecked.not_wip.limit(Product.count - PAGINATES_PER).delete_all
newest_product = Product.unassigned.unchecked.not_wip.reorder(:id).first
newest_product.update(published_at: Time.current)
oldest_product = Product.unassigned.unchecked.not_wip.reorder(:id).last
Expand Down

0 comments on commit 6a884a6

Please sign in to comment.