智能组卷的可选题数

sso
cxt 5 years ago
parent de135d0dcd
commit 213fb8cd09

@ -22,10 +22,12 @@ class OptionalItemQuery < ApplicationQuery
items = ItemBank.where(container_id: hacks.pluck(:id), container_type: "Hack").or(ItemBank.where(id: items.pluck(:id))) items = ItemBank.where(container_id: hacks.pluck(:id), container_type: "Hack").or(ItemBank.where(id: items.pluck(:id)))
end end
# 来源
public = source.present? ? source.to_i : 1 public = source.present? ? source.to_i : 1
public = public == 2 ? [0, 1] : public if public == 1
items = items.where(public: public) items = items.where(public: 1)
elsif public == 0
items = items.where(user_id: User.current.id)
end
# 难度 # 难度
diff = difficulty ? difficulty.to_i : 1 diff = difficulty ? difficulty.to_i : 1

Loading…
Cancel
Save