|
|
@ -2442,11 +2442,11 @@ class UsersController < ApplicationController
|
|
|
|
shixun_ids = @user.shixun_members.map(&:shixun_id) + @user.myshixuns.map(&:shixun_id)
|
|
|
|
shixun_ids = @user.shixun_members.map(&:shixun_id) + @user.myshixuns.map(&:shixun_id)
|
|
|
|
shixun_ids = shixun_ids.size > 0 ? ("(" + shixun_ids.uniq.join(",") + ")") : "(-1)"
|
|
|
|
shixun_ids = shixun_ids.size > 0 ? ("(" + shixun_ids.uniq.join(",") + ")") : "(-1)"
|
|
|
|
@objects = @show_all ?
|
|
|
|
@objects = @show_all ?
|
|
|
|
Shixun.find_by_sql("select s.id,s.name,s.user_id,s.challenges_count,s.status,s.identifier
|
|
|
|
Shixun.find_by_sql("select distinct(s.id),s.name,s.user_id,s.challenges_count,s.status,s.identifier
|
|
|
|
from shixuns s LEFT JOIN (SELECT str.shixun_id, tr.name FROM shixun_tag_repertoires str LEFT JOIN tag_repertoires tr ON str.tag_repertoire_id = tr.id
|
|
|
|
from shixuns s LEFT JOIN (SELECT str.shixun_id, tr.name FROM shixun_tag_repertoires str LEFT JOIN tag_repertoires tr ON str.tag_repertoire_id = tr.id
|
|
|
|
) sstr ON s.id = sstr.shixun_id
|
|
|
|
) sstr ON s.id = sstr.shixun_id
|
|
|
|
where s.status != -1 and s.id in #{shixun_ids} order by #{sort_str} #{order}") :
|
|
|
|
where s.status != -1 and s.id in #{shixun_ids} order by #{sort_str} #{order}") :
|
|
|
|
Shixun.find_by_sql("select s.id,s.name,s.user_id,s.challenges_count,s.status,s.identifier
|
|
|
|
Shixun.find_by_sql("select distinct(s.id),s.name,s.user_id,s.challenges_count,s.status,s.identifier
|
|
|
|
from shixuns s LEFT JOIN (SELECT str.shixun_id, tr.name FROM shixun_tag_repertoires str LEFT JOIN tag_repertoires tr ON str.tag_repertoire_id = tr.id
|
|
|
|
from shixuns s LEFT JOIN (SELECT str.shixun_id, tr.name FROM shixun_tag_repertoires str LEFT JOIN tag_repertoires tr ON str.tag_repertoire_id = tr.id
|
|
|
|
) sstr ON s.id = sstr.shixun_id
|
|
|
|
) sstr ON s.id = sstr.shixun_id
|
|
|
|
where s.status in (2, 3) and s.hidden =0 and s.id in #{shixun_ids}
|
|
|
|
where s.status in (2, 3) and s.hidden =0 and s.id in #{shixun_ids}
|
|
|
@ -2456,22 +2456,22 @@ class UsersController < ApplicationController
|
|
|
|
shixun_ids = @user.myshixuns.where(:status => status).map(&:shixun_id)
|
|
|
|
shixun_ids = @user.myshixuns.where(:status => status).map(&:shixun_id)
|
|
|
|
shixun_ids = shixun_ids.size > 0 ? ("(" + shixun_ids.join(",") + ")") : "(-1)"
|
|
|
|
shixun_ids = shixun_ids.size > 0 ? ("(" + shixun_ids.join(",") + ")") : "(-1)"
|
|
|
|
@objects = @show_all ?
|
|
|
|
@objects = @show_all ?
|
|
|
|
Shixun.find_by_sql("select s.id,s.name,s.user_id,s.challenges_count,s.status,s.identifier
|
|
|
|
Shixun.find_by_sql("select distinct(s.id),s.name,s.user_id,s.challenges_count,s.status,s.identifier
|
|
|
|
from shixuns s LEFT JOIN (SELECT str.shixun_id, tr.name FROM shixun_tag_repertoires str LEFT JOIN tag_repertoires tr ON str.tag_repertoire_id = tr.id
|
|
|
|
from shixuns s LEFT JOIN (SELECT str.shixun_id, tr.name FROM shixun_tag_repertoires str LEFT JOIN tag_repertoires tr ON str.tag_repertoire_id = tr.id
|
|
|
|
) sstr ON s.id = sstr.shixun_id
|
|
|
|
) sstr ON s.id = sstr.shixun_id
|
|
|
|
where s.status != -1 and s.id in #{shixun_ids} order by #{sort_str} #{order}") :
|
|
|
|
where s.status != -1 and s.id in #{shixun_ids} order by #{sort_str} #{order}") :
|
|
|
|
Shixun.find_by_sql("select s.id,s.name,s.user_id,s.challenges_count,s.status,s.identifier
|
|
|
|
Shixun.find_by_sql("select distinct(s.id),s.name,s.user_id,s.challenges_count,s.status,s.identifier
|
|
|
|
from shixuns s LEFT JOIN (SELECT str.shixun_id, tr.name FROM shixun_tag_repertoires str LEFT JOIN tag_repertoires tr ON str.tag_repertoire_id = tr.id
|
|
|
|
from shixuns s LEFT JOIN (SELECT str.shixun_id, tr.name FROM shixun_tag_repertoires str LEFT JOIN tag_repertoires tr ON str.tag_repertoire_id = tr.id
|
|
|
|
) sstr ON s.id = sstr.shixun_id
|
|
|
|
) sstr ON s.id = sstr.shixun_id
|
|
|
|
where s.status in (2, 3) and s.hidden =0 and s.id in #{shixun_ids}
|
|
|
|
where s.status in (2, 3) and s.hidden =0 and s.id in #{shixun_ids}
|
|
|
|
order by #{sort_str} #{order}")
|
|
|
|
order by #{sort_str} #{order}")
|
|
|
|
else
|
|
|
|
else
|
|
|
|
@objects = @show_all ?
|
|
|
|
@objects = @show_all ?
|
|
|
|
Shixun.find_by_sql("select s.id,s.name,s.user_id,s.challenges_count,s.status,s.identifier
|
|
|
|
Shixun.find_by_sql("select distinct(s.id),s.name,s.user_id,s.challenges_count,s.status,s.identifier
|
|
|
|
from shixuns s, myshixuns ms
|
|
|
|
from shixuns s, myshixuns ms
|
|
|
|
where ms.user_id = #{@user.id} AND ms.status in (#{status.join(",")}) and s.id = ms.shixun_id
|
|
|
|
where ms.user_id = #{@user.id} AND ms.status in (#{status.join(",")}) and s.id = ms.shixun_id
|
|
|
|
order by ms.updated_at #{order}") :
|
|
|
|
order by ms.updated_at #{order}") :
|
|
|
|
Shixun.find_by_sql("select s.id,s.name,s.user_id,s.challenges_count,s.status,s.identifier
|
|
|
|
Shixun.find_by_sql("select distinct(s.id),s.name,s.user_id,s.challenges_count,s.status,s.identifier
|
|
|
|
from shixuns s, myshixuns ms
|
|
|
|
from shixuns s, myshixuns ms
|
|
|
|
where ms.user_id = #{@user.id} and s.status in (2, 3) and s.hidden =0 and s.id = ms.shixun_id
|
|
|
|
where ms.user_id = #{@user.id} and s.status in (2, 3) and s.hidden =0 and s.id = ms.shixun_id
|
|
|
|
order by ms.updated_at #{order}")
|
|
|
|
order by ms.updated_at #{order}")
|
|
|
|