修改课程中一个错误,完善匿评
This commit is contained in:
parent
bb23468c7d
commit
53d85136a3
|
@ -265,8 +265,7 @@ class CoursesController < ApplicationController
|
|||
@members = cs.course_teacher_or_student_list(params,@course,User.current)
|
||||
@members = paginateHelper @members
|
||||
render :layout => 'base_courses'
|
||||
|
||||
rescue Exception => e
|
||||
end
|
||||
if e.message == '403'
|
||||
render_403
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ class HomeworkService
|
|||
def show_homework params
|
||||
@bid = Bid.find(params[:id])
|
||||
course = @bid.courses.first
|
||||
is_teacher = is_course_teacher(User.current,course)
|
||||
is_teacher = is_course_teacher(User.current, course)
|
||||
author = @bid.author.firstname + @bid.author.lastname
|
||||
many_times = course.homeworks.index(@bid) + 1
|
||||
name = @bid.name
|
||||
|
@ -53,11 +53,32 @@ class HomeworkService
|
|||
|
||||
#匿评作品详情
|
||||
def anonymous_works_show params
|
||||
@homework = HomeworkAttach.find(params[:id])
|
||||
if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first)
|
||||
|
||||
@homework = HomeworkAttach.find(params[:homework_id])
|
||||
name = @homework.name
|
||||
desc = @homework.description
|
||||
datetime = @homework.created_at
|
||||
unless @homework.attachments.empty?
|
||||
attachs = @homework.attachments
|
||||
attachs.each do |attach|
|
||||
filename = attach.name
|
||||
filedesc = attach.description unless attachment.description.blank?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
#作品打分
|
||||
def add_score_and_jour
|
||||
@is_teacher,@is_anonymous_comments,@m_score = params[:is_teacher]=="true",params[:is_anonymous_comments]=="true",params[:stars_value]
|
||||
@cur_page,@cur_type = params[:cur_page] || 1,params[:cur_type] || 5
|
||||
@homework = HomeworkAttach.find(params[:homework_id])
|
||||
#保存评分
|
||||
@homework.rate(@m_score.to_i,User.current.id,:quality) if @m_score
|
||||
#保存评论
|
||||
@is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言
|
||||
if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" #有没有留言
|
||||
@homework.addjours User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
Loading…
Reference in New Issue