|
|
|
@ -23,6 +23,7 @@ class HomeworkAttachController < ApplicationController
|
|
|
|
|
@jour = @jours[@offset, @limit]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#删除留言
|
|
|
|
|
def destroy
|
|
|
|
|
@journal_destroyed = JournalsForMessage.delete_message(params[:object_id])
|
|
|
|
|
respond_to do |format|
|
|
|
|
@ -30,6 +31,7 @@ class HomeworkAttachController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#添加留言
|
|
|
|
|
def addjours
|
|
|
|
|
@homework = HomeworkAttach.find(params[:jour_id])
|
|
|
|
|
@homework.addjours User.current.id, params[:new_form][:user_message],0
|
|
|
|
@ -43,5 +45,17 @@ class HomeworkAttachController < ApplicationController
|
|
|
|
|
format.js
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#获取指定作业的平均得分
|
|
|
|
|
def score
|
|
|
|
|
#stars_reates = @homework.rates(:quality)
|
|
|
|
|
#percent = 0
|
|
|
|
|
#stars_reates.each do |star_reates|
|
|
|
|
|
# percent = percent + star_reates.stars
|
|
|
|
|
#end
|
|
|
|
|
#stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count
|
|
|
|
|
#result = percent * 1.0 / stars_reates_count
|
|
|
|
|
#result
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|