|
|
|
@ -34,8 +34,10 @@ class Users::ShixunService
|
|
|
|
|
|
|
|
|
|
def status_filter(relations)
|
|
|
|
|
case params[:category]
|
|
|
|
|
when 'study', 'collect' then
|
|
|
|
|
when 'study' then
|
|
|
|
|
study_shixun_status_filter(relations)
|
|
|
|
|
when 'collect' then
|
|
|
|
|
collect_shixun_status_filter(relations)
|
|
|
|
|
when 'manage' then
|
|
|
|
|
manage_shixun_status_filter(relations)
|
|
|
|
|
else
|
|
|
|
@ -66,6 +68,16 @@ class Users::ShixunService
|
|
|
|
|
relations
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def collect_shixun_status_filter relations
|
|
|
|
|
passed_shixun_ids = user.myshixuns.where(shixun_id: relations, status: 1).pluck(:shixun_id)
|
|
|
|
|
if params[:status] == 'passed'
|
|
|
|
|
relations = relations.where(id: passed_shixun_ids)
|
|
|
|
|
elsif params[:status] == 'processing'
|
|
|
|
|
relations = relations.where.not(id: passed_shixun_ids)
|
|
|
|
|
end
|
|
|
|
|
relations
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def manage_shixun_status_filter(relations)
|
|
|
|
|
if params[:status] == "publiced"
|
|
|
|
|
relations = relations.where(public: 2)
|
|
|
|
|