dev_tj
cxt 5 years ago
parent 5f65b9d25f
commit 55e399cab5

@ -12,13 +12,7 @@ class ItemBasketsController < ApplicationController
end
def basket_list
@single_questions_count = current_user.item_baskets.where(item_type: "SINGLE").count
@multiple_questions_count = current_user.item_baskets.where(item_type: "MULTIPLE").count
@judgement_questions_count = current_user.item_baskets.where(item_type: "JUDGMENT").count
@completion_questions_count = current_user.item_baskets.where(item_type: "COMPLETION").count
@subjective_questions_count = current_user.item_baskets.where(item_type: "SUBJECTIVE").count
@practical_questions_count = current_user.item_baskets.where(item_type: "PRACTICAL").count
@program_questions_count = current_user.item_baskets.where(item_type: "PROGRAM").count
@basket_count = current_user.item_baskets.group(:item_type).count
end
def create

@ -1,7 +1,7 @@
json.single_questions_count @single_questions_count
json.multiple_questions_count @multiple_questions_count
json.judgement_questions_count @judgement_questions_count
json.completion_questions_count @completion_questions_count
json.subjective_questions_count @subjective_questions_count
json.practical_questions_count @practical_questions_count
json.program_questions_count @program_questions_count
json.single_questions_count @basket_count&.fetch("SINGLE", 0)
json.multiple_questions_count @basket_count&.fetch("MULTIPLE", 0)
json.judgement_questions_count @basket_count&.fetch("JUDGMENT", 0)
json.completion_questions_count @basket_count&.fetch("COMPLETION", 0)
json.subjective_questions_count @basket_count&.fetch("SUBJECTIVE", 0)
json.practical_questions_count @basket_count&.fetch("PRACTICAL", 0)
json.program_questions_count @basket_count&.fetch("PROGRAM", 0)
Loading…
Cancel
Save