增加作业按评分排序
This commit is contained in:
parent
39ce95a950
commit
b0a88eb5ac
|
@ -407,7 +407,10 @@ class BidsController < ApplicationController
|
|||
|
||||
if @bid.homework_type == 1
|
||||
@homework = HomeworkAttach.new
|
||||
@homework_list = @bid.homeworks
|
||||
#@homework_list = @bid.homeworks
|
||||
@homework_list = HomeworkAttach.find_by_sql("SELECT homework_attaches.*,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id) AS score
|
||||
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY score DESC")
|
||||
if params[:student_id].present?
|
||||
@temp = []
|
||||
@homework_list.each do |pro|
|
||||
|
|
Loading…
Reference in New Issue