|
|
@ -129,7 +129,7 @@ class ShixunsController < ApplicationController
|
|
|
|
select m.user_id, u.login, u.lastname, m.updated_at,
|
|
|
|
select m.user_id, u.login, u.lastname, m.updated_at,
|
|
|
|
(select sum(cost_time) from games g where g.myshixun_id = m.id) as time,
|
|
|
|
(select sum(cost_time) from games g where g.myshixun_id = m.id) as time,
|
|
|
|
(select sum(final_score) from games g where g.myshixun_id = m.id) as score
|
|
|
|
(select sum(final_score) from games g where g.myshixun_id = m.id) as score
|
|
|
|
from (myshixuns m join users u on m.user_id = u.id) where m.shixun_id = #{@shixun.id} and m.status = 1
|
|
|
|
from (users u left join myshixuns m on m.user_id = u.id) where m.shixun_id = #{@shixun.id} and m.status = 1
|
|
|
|
order by score desc, time asc limit 10
|
|
|
|
order by score desc, time asc limit 10
|
|
|
|
"
|
|
|
|
"
|
|
|
|
@myshixuns = Myshixun.find_by_sql(sql)
|
|
|
|
@myshixuns = Myshixun.find_by_sql(sql)
|
|
|
|