class ItemBasket < ApplicationRecord enum item_type: { SINGLE: 0, MULTIPLE: 1, JUDGMENT: 2, COMPLETION: 3, SUBJECTIVE: 4, PRACTICAL: 5, PROGRAM: 6 } belongs_to :item_bank belongs_to :user def all_score User.current.item_baskets.map(&:score).sum end def question_count User.current.item_baskets.size end end