修改作业详情接口
This commit is contained in:
parent
fdb38c1b87
commit
fd1dc80bf0
|
@ -16,7 +16,8 @@ module Mobile
|
||||||
end
|
end
|
||||||
route_param :id do
|
route_param :id do
|
||||||
get do
|
get do
|
||||||
get_service.show_homework params
|
hs = HomeworkService.new
|
||||||
|
hs.show_homework params
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,16 +13,17 @@ class HomeworkService
|
||||||
def show_homework params
|
def show_homework params
|
||||||
@bid = Bid.find(params[:id])
|
@bid = Bid.find(params[:id])
|
||||||
course = @bid.courses.first
|
course = @bid.courses.first
|
||||||
author = @bid.author.firstname + @bid.author.lastname
|
author = @bid.author.lastname + @bid.author.firstname
|
||||||
many_times = course.homeworks.index(@bid) + 1
|
many_times = course.homeworks.index(@bid) + 1
|
||||||
name = @bid.name
|
name = @bid.name
|
||||||
homework_count = @bid.homeworks.count
|
homework_count = @bid.homeworks.count #已提交的作业数量
|
||||||
|
student_questions_count = @bid.commit.nil? ? 0 : @bid.commit
|
||||||
description = @bid.description
|
description = @bid.description
|
||||||
if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
|
if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
|
||||||
state = bid.comment_status
|
state = bid.comment_status
|
||||||
end
|
end
|
||||||
{:course => 'course', :atuthor => 'author', :many_times => 'many_times', :name => 'name', :homework_count => 'homework_count',
|
{:course => course, :atuthor => author, :many_times => many_times, :name => name, :homework_count => homework_count,:student_questions_count => student_questions_count,
|
||||||
:descriptiong => 'description', :state => 'state'}
|
:descriptiong => description, :state => state}
|
||||||
end
|
end
|
||||||
|
|
||||||
# 启动作业匿评
|
# 启动作业匿评
|
||||||
|
|
Loading…
Reference in New Issue