Merge branch 'dev_item_bank' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_item_bank

dev_jupyter
杨树林 5 years ago
commit ad26a2dad2

@ -23,7 +23,11 @@ class ItemBankQuery < ApplicationQuery
items = items.joins(:sub_discipline).where(sub_disciplines: {discipline_id: params[:discipline_id]}) items = items.joins(:sub_discipline).where(sub_disciplines: {discipline_id: params[:discipline_id]})
end end
items = items.where(item_type: params[:item_type].to_i) if params[:item_type].present? if params[:oj_status].present? && params[:item_type] == "PROGRAM"
items = items.joins("join hacks on hacks.id=item_banks.container_id and item_banks.container_type='Hack'").where(hacks: {status: params[:oj_status]})
end
items = items.where(item_type: params[:item_type]) if params[:item_type].present?
items = items.where(difficulty: params[:difficulty].to_i) if params[:difficulty].present? items = items.where(difficulty: params[:difficulty].to_i) if params[:difficulty].present?
items = items.where("name like ?", "%#{params[:keyword].strip}%") if params[:keyword].present? items = items.where("name like ?", "%#{params[:keyword].strip}%") if params[:keyword].present?

@ -6,6 +6,6 @@ json.choices item.item_choices do |choice|
end end
if item.item_type == "PROGRAM" if item.item_type == "PROGRAM"
json.program_attr do json.program_attr do
json.(item.container, :description, :language, :difficult) json.(item.container, :description, :language, :difficult, :status, :identifier)
end end
end end
Loading…
Cancel
Save