修改作业详情接口

This commit is contained in:
z9hang 2015-01-07 16:02:16 +08:00
parent fdb38c1b87
commit fd1dc80bf0
2 changed files with 7 additions and 5 deletions

View File

@ -16,7 +16,8 @@ module Mobile
end
route_param :id do
get do
get_service.show_homework params
hs = HomeworkService.new
hs.show_homework params
end
end

View File

@ -13,16 +13,17 @@ class HomeworkService
def show_homework params
@bid = Bid.find(params[:id])
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
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
if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
state = bid.comment_status
end
{:course => 'course', :atuthor => 'author', :many_times => 'many_times', :name => 'name', :homework_count => 'homework_count',
:descriptiong => 'description', :state => 'state'}
{:course => course, :atuthor => author, :many_times => many_times, :name => name, :homework_count => homework_count,:student_questions_count => student_questions_count,
:descriptiong => description, :state => state}
end
# 启动作业匿评