|
|
|
@ -7,7 +7,7 @@ class StudentWorkController < ApplicationController
|
|
|
|
|
require "base64"
|
|
|
|
|
helper :attachments
|
|
|
|
|
helper :files
|
|
|
|
|
before_filter :find_homework, :only => [:new, :index, :create, :homework_discuss, :homework_setting, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,
|
|
|
|
|
before_filter :find_homework, :only => [:new, :index, :sonar, :create, :homework_discuss, :homework_setting, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,
|
|
|
|
|
:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,
|
|
|
|
|
:search_course_students,:work_canrepeat,:change_project,:relate_myshixun,:shixun_work_export,:import_score,:code_review_results]
|
|
|
|
|
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :adjust_score, :add_ultimate_score, :praise_student_work, :retry_work, :revise_attachment, :hide_score_detail, :destroy_score,
|
|
|
|
@ -15,7 +15,7 @@ class StudentWorkController < ApplicationController
|
|
|
|
|
before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work, :commit_summary, :view_summary]
|
|
|
|
|
before_filter :author_of_work, :only => [:edit, :update, :destroy]
|
|
|
|
|
before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment, :adjust_score, :add_ultimate_score]
|
|
|
|
|
before_filter :require_login, :only => [:index, :show]
|
|
|
|
|
before_filter :require_login, :only => [:index, :sonar, :show]
|
|
|
|
|
|
|
|
|
|
if RUBY_PLATFORM =~ /linux/
|
|
|
|
|
require 'roo-xls'
|
|
|
|
@ -493,7 +493,7 @@ class StudentWorkController < ApplicationController
|
|
|
|
|
render :json => resultObj
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
|
def _index
|
|
|
|
|
# REDO:分班信息提前查出来,然后循环中根据匹配去取
|
|
|
|
|
|
|
|
|
|
@is_teacher = User.current.logged? ? (User.current.allowed_to?(:as_teacher,@course) || User.current.admin?) : false
|
|
|
|
@ -608,6 +608,12 @@ class StudentWorkController < ApplicationController
|
|
|
|
|
@page = (params['page'] || 1).to_i
|
|
|
|
|
@student_work_pages = Paginator.new @student_work_count, @limit, @page
|
|
|
|
|
@offset ||= @student_work_pages.offset
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
|
_index
|
|
|
|
|
|
|
|
|
|
@stundet_works = paginateHelper @stundet_works, @limit
|
|
|
|
|
if @stundet_works.size != 0
|
|
|
|
|
@stundet_works = if @homework.homework_type == 1
|
|
|
|
@ -630,6 +636,35 @@ class StudentWorkController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sonar
|
|
|
|
|
_index
|
|
|
|
|
logger.debug "@stundet_works #{@stundet_works}"
|
|
|
|
|
|
|
|
|
|
person_list = @stundet_works.map do |work|
|
|
|
|
|
o = {
|
|
|
|
|
name: "#{work.user.show_real_name}",
|
|
|
|
|
uid: "#{work.user.user_extensions.student_id}",
|
|
|
|
|
downloadUrl: ''
|
|
|
|
|
}
|
|
|
|
|
attachment = work.attachments.first
|
|
|
|
|
if attachment
|
|
|
|
|
o[:downloadUrl] = "https://#{Setting.host_name}/"+download_named_attachment_path(attachment.id, attachment.filename)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
o
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.json {
|
|
|
|
|
render json: {
|
|
|
|
|
homeworkId: @homework.id,
|
|
|
|
|
personList: person_list
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 查重详情页面的调分
|
|
|
|
|
def adjust_review_score
|
|
|
|
|
if params[:score] && params[:challenge_id]
|
|
|
|
@ -1852,6 +1887,7 @@ class StudentWorkController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def hsd_committed_work?(user, homework)
|
|
|
|
|