diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index dd9b1bda..df1fdcd6 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -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 respond_to do |format| format.js @@ -620,6 +626,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] @@ -1842,6 +1877,7 @@ class StudentWorkController < ApplicationController end end + private def hsd_committed_work?(user, homework) diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index f48bf0b2..d4352309 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -15,36 +15,37 @@
- <%= link_to @homework.course.name, course_path(@homework.course),:class => "color-grey-9" %> - > <% if @homework.course_homework_category.present? %> - <%= link_to @homework.course_homework_category.name, homework_common_index_path(:course => @homework.course_id, :homework_type => @homework.homework_type, :category => @homework.course_homework_category_id), :class => "color-grey-9" %> - <% else %> - <%= link_to "#{@homework.homework_type_ch}作业", homework_common_index_path(:course => @homework.course_id, :homework_type => @homework.homework_type),:class => "color-grey-9" %> - <% end %> + <%= link_to @homework.course.name, course_path(@homework.course), :class => "color-grey-9" %> + > + <% if @homework.course_homework_category.present? %> + <%= link_to @homework.course_homework_category.name, homework_common_index_path(:course => @homework.course_id, :homework_type => @homework.homework_type, :category => @homework.course_homework_category_id), :class => "color-grey-9" %> + <% else %> + <%= link_to "#{@homework.homework_type_ch}作业", homework_common_index_path(:course => @homework.course_id, :homework_type => @homework.homework_type), :class => "color-grey-9" %> + <% end %> > #<%= get_hw_index(@homework, @is_teacher, @homework.homework_type) + 1 %>
@@ -72,11 +73,11 @@ <% end %> <% if @is_teacher && @homework.homework_type == 4 && @homework.homework_group_reviews.count > 0 %> -
<% groups.each do |group| %> > - + <% end %> <% if !@group_teacher %> @@ -241,6 +246,10 @@ <% end %> <% end %> + <% if User.current.admin? %> + 质量检测 + <% end %> +