diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 4c6023265..6fe639260 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -1,115 +1,109 @@ +#encoding: utf-8 class ExerciseController < ApplicationController layout "base_courses" before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy, :commit_exercise, :commit_answer,:publish_exercise,:republish_exercise, :show_student_result,:student_exercise_list, :update_question_num, - :send_to_course, :get_student_uncomplete_question, :edit_question_score] + :send_to_course, :get_student_uncomplete_question, :edit_question_score, :setting, :set_public, + :ex_setting] before_filter :find_course, :only => [:index,:new,:create] include ExerciseHelper def index - publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) - publish_exercises.each do |exercise| - exercise.update_column('exercise_status', 2) - course = exercise.course - course.members.each do |m| - exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) - end - end - if @course.is_public == 0 && !(User.current.member_of_course?(@course)||User.current.admin?) render_403 return end - remove_invalid_exercise(@course) - @is_teacher = User.current.allowed_to?(:as_teacher,@course) - if @is_teacher || User.current.admin? - exercises = @course.exercises.order("created_at asc") + #remove_invalid_exercise(@course) + @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? + if @is_teacher + exercises = @course.exercises.order("created_at desc") else - exercises = @course.exercises.where("exercise_status <> 1").order("created_at asc") + exercises = @course.exercises.where("exercise_status <> 1").order("created_at desc") end - @exercises = paginateHelper exercises,20 #分页 + if params[:type] + @type = params[:type] + exercises = exercises.where(:exercise_status => params[:type]) + end + @search = params[:search] ? params[:search].to_s.strip : "" + if params[:search] + exercises = exercises.where("exercise_name like '%#{@search}%'") + end + @exercises = paginateHelper exercises,15 #分页 @left_nav_type = 8 respond_to do |format| + format.js format.html end end def show - publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) - publish_exercises.each do |exercise| - exercise.update_column('exercise_status', 2) - course = exercise.course - course.members.each do |m| - exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) - end - end - unless User.current.member_of_course?(@course) || User.current.admin? render_403 return end - @exercise = Exercise.find params[:id] @exercise.course_messages.each do |message| if User.current.id == message.user_id && message.viewed == 0 message.update_attributes(:viewed => true) if message.viewed == 0 end end @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? - exercise_end = @exercise.end_time.nil? ? false : @exercise.end_time > Time.now - if @exercise.time == -1 - @can_edit_excercise = exercise_end - else - @can_edit_excercise = !has_commit_exercise?(@exercise.id,User.current.id)&& exercise_end - end + unless @is_teacher @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first if @exercise_user.nil? eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false) @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first + elsif @exercise_user.start_at.nil? + @exercise_user.update_attributes(:start_at => Time.now) + end + + exercise_end = @exercise.end_time.nil? ? false : @exercise.end_time > Time.now + if @exercise.time == -1 + @can_edit_excercise = exercise_end && @exercise_user.commit_status == 0 + else + @can_edit_excercise = !has_commit_exercise?(@exercise.id,User.current.id) && exercise_end end #score = calculate_student_score(@exercise, User.current) #@exercise_user.update_attributes(:objective_score => score, :score => (score + (@exercise_user.subjective_score > 0 ? @exercise_user.subjective_score : 0))) + else + @can_edit_excercise = false end # @percent = get_percent(@exercise,User.current) - @exercise_questions = @exercise.exercise_questions - @left_nav_type = 8 + #@exercise_questions = @exercise.exercise_questions respond_to do |format| - format.html {render :layout => 'base_courses'} + format.html {render :layout => 'base_edu'} end #end end def new - option = { - :exercise_name => "", - :course_id => @course.id, - :exercise_status => 1, - :user_id => User.current.id, - :time => "", - :end_time => "", - :publish_time => "", - :exercise_description => "", - :show_result => 1 - } - @exercise = Exercise.create option - if @exercise - redirect_to edit_exercise_url @exercise.id + # option = { + # :exercise_name => "", + # :course_id => @course.id, + # :exercise_status => 1, + # :user_id => User.current.id, + # :time => "", + # :end_time => "", + # :publish_time => "", + # :exercise_description => "", + # :show_result => 1 + # } + @exercise = Exercise.new + respond_to do |format| + format.html{render :layout => 'base_edu'} end end def create if params[:exercise] - exercise = Exercise.find(params[:exercise_id]) if params[:exercise_id] - exercise ||= Exercise.new + exercise = Exercise.new exercise.exercise_name = params[:exercise][:exercise_name] exercise.exercise_description = params[:exercise][:exercise_description] - exercise.end_time = Time.at(params[:exercise][:end_time].to_time.to_i + 16*60*60 -1) - exercise.publish_time = params[:exercise][:publish_time] exercise.user_id = User.current.id - exercise.time = params[:exercise][:time] exercise.course_id = params[:course_id] + exercise.time = -1 exercise.exercise_status = 1 if exercise.save @exercise = exercise @@ -121,21 +115,15 @@ class ExerciseController < ApplicationController end def edit - @left_nav_type = 8 respond_to do |format| - format.html{render :layout => 'base_courses'} - end + format.html{render :layout => 'base_edu'} + end end def update @exercise.exercise_name = params[:exercise][:exercise_name] @exercise.exercise_description = params[:exercise][:exercise_description] - @exercise.time = params[:exercise][:time].blank? ? -1 : params[:exercise][:time] - @exercise.end_time = Time.at(params[:exercise][:end_time].to_time.to_i + 16*60*60 -1) - @exercise.publish_time = params[:exercise][:publish_time] - @exercise.show_result = params[:show_result] ? 1 : 0 - @exercise.question_random = params[:question_random] ? 0 : 1 - @exercise.choice_random = params[:choice_random] ? 0 : 1 + if @exercise.save respond_to do |format| format.js @@ -148,15 +136,34 @@ class ExerciseController < ApplicationController def destroy @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? if @exercise && @exercise.destroy - if @is_teacher - exercises = Exercise.where("course_id =?", @course.id) - else - exercises = Exercise.where("course_id =? and exercise_status =?", @course.id, 2) - end - @exercises = paginateHelper exercises,20 #分页 - respond_to do |format| - format.js - end + redirect_to exercise_index_path(:course_id => @course.id) + end + end + + def setting + @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? + @is_new = params[:is_new] ? true : false + respond_to do |format| + format.html{render :layout => 'base_edu'} + end + end + + def ex_setting + @exercise.publish_time = params[:exercise_publish_time] if params[:exercise_publish_time] + @exercise.end_time = params[:exercise_end_time] if params[:exercise_end_time] + @exercise.time = -1 + @exercise.question_random = params[:question_random] ? 1 : 0 + @exercise.choice_random = params[:choice_random] ? 1 : 0 + @exercise.score_open = params[:score_open] ? 1 : 0 + @exercise.answer_open = params[:answer_open] ? 1 : 0 + if @exercise.save + redirect_to student_exercise_list_exercise_path(@exercise) + end + end + + def set_public + if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) + @exercise.update_attributes(:is_public => true) end end @@ -178,10 +185,7 @@ class ExerciseController < ApplicationController option = { :question_title => question_title, :question_type => params[:question_type] || 1, - :question_number => params[:question_type] == "1"? @exercise.exercise_questions.where("question_type = 1").count + 1 : - (params[:question_type] == "2" ? (@exercise.exercise_questions.where("question_type = 2").count + 1) : - (params[:question_type] == "3" ? (@exercise.exercise_questions.where("question_type = 3").count + 1) : - @exercise.exercise_questions.where("question_type = 4").count + 1)), + :question_number => @exercise.exercise_questions.count + 1, :question_score => params[:question_score] } @exercise_questions = @exercise.exercise_questions.new option @@ -197,20 +201,23 @@ class ExerciseController < ApplicationController end end # 如果是插入的话,那么从插入的这个id以后的question_num都将要+1 - if params[:quest_id] + if params[:quest_id] != "0" @is_insert = true - if @exercise_questions.question_type == 1 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number + 1") - #@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1") - elsif @exercise_questions.question_type == 2 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number + 1") - elsif @exercise_questions.question_type == 3 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number + 1") - else - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 4).update_all(" question_number = question_number + 1") + insert_que = ExerciseQuestion.find params[:quest_id] + if insert_que + @exercise.exercise_questions.where("question_number>?",insert_que.question_number).update_all("question_number = question_number + 1") + # if @exercise_questions.question_type == 1 + # ExerciseQuestion.where("question_number>?",params[:quest_num].to_i).update_all(" question_number = question_number + 1") + # elsif @exercise_questions.question_type == 2 + # ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number + 1") + # elsif @exercise_questions.question_type == 3 + # ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number + 1") + # else + # ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 4).update_all(" question_number = question_number + 1") + # end + # @exercise_question_num = params[:quest_num].to_i + @exercise_questions.question_number = insert_que.question_number + 1 end - # @exercise_question_num = params[:quest_num].to_i - @exercise_questions.question_number = params[:quest_num].to_i + 1 end if @exercise_questions.save # params[:exercise_choice] 标准答案参数 @@ -327,16 +334,17 @@ class ExerciseController < ApplicationController @exercise_question = ExerciseQuestion.find params[:exercise_question] @exercise = @exercise_question.exercise - if @exercise_question.question_type == 1 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number - 1") - #@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1") - elsif @exercise_question.question_type == 2 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number - 1") - elsif @exercise_question.question_type == 3 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number - 1") - else - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 4).update_all(" question_number = question_number - 1") - end + ExerciseQuestion.where("question_number>?",params[:quest_num].to_i).update_all("question_number = question_number - 1") + # if @exercise_question.question_type == 1 + # ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number - 1") + # #@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1") + # elsif @exercise_question.question_type == 2 + # ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number - 1") + # elsif @exercise_question.question_type == 3 + # ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number - 1") + # else + # ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 4).update_all(" question_number = question_number - 1") + # end # @exercise_question_num = params[:quest_num].to_i # @exercise_questions.question_number = params[:quest_num].to_i - 1 # @@ -358,12 +366,12 @@ class ExerciseController < ApplicationController exercise_questions = @exercise.exercise_questions if @exercise_question if params[:opr] == 'up' && @exercise_question.question_number > 1 - @before_que = exercise_questions.where("question_type = #{@exercise_question.question_type} and question_number = #{@exercise_question.question_number - 1}").first + @before_que = exercise_questions.where("question_number = #{@exercise_question.question_number - 1}").first if @before_que && @exercise_question.update_attribute('question_number', @exercise_question.question_number - 1) @before_que.update_attribute('question_number', @before_que.question_number + 1) end elsif params[:opr] == 'down' && @exercise_question.question_number < exercise_questions.count - @after_que = exercise_questions.where("question_type = #{@exercise_question.question_type} and question_number = #{@exercise_question.question_number + 1}").first + @after_que = exercise_questions.where("question_number = #{@exercise_question.question_number + 1}").first if @after_que && @exercise_question.update_attribute('question_number', @exercise_question.question_number + 1) @after_que.update_attribute('question_number', @after_que.question_number - 1) end @@ -470,77 +478,68 @@ class ExerciseController < ApplicationController end def student_exercise_list -=begin - if @exercise.end_time <= Time.now - @course.student.each do |student| - if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,@exercise.id).empty? - ExerciseUser.create(:user_id => student.student_id, :exercise_id => @exercise.id, :start_at => @exercise.end_time, :status => true,:score=>0) - end - - s_score = calculate_student_score(@exercise, student.student) - exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", student.student_id, @exercise.id).first - exercise_user.update_attributes(:score => s_score) - end - end -=end - @name,@select_group = params[:name].to_s.strip || "",params[:group] + @order,@b_sort,@name,@group,@comment,@status = params[:order] || "end_at",params[:sort] || "desc",params[:name].to_s.strip || "",params[:ex_group], params[:ex_comment], params[:ex_status] @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? - if @is_teacher - @all_exercises = @course.exercises.order("created_at desc") - else - @all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc") - end + student_id = @course.student.blank? ? "(-1)" : "(" + @course.student.map{|student| student.student_id}.join(",") + ")" - if @select_group - if @select_group == "0" - none_group_students = @course.members.select{ |member| member.course_group_id == 0 } - if none_group_students.empty? - student_in_group = '(0)' - else - student_in_group = '(' + none_group_students.map{ |member| member.user_id }.join(',') + ')' - end - elsif @select_group == "-1" - all_group_students = @course.members.select{ |member| member.course_group_id } - if all_group_students.empty? - student_in_group = '(0)' - else - student_in_group = '(' + all_group_students.map{ |member| member.user_id }.join(',') + ')' - end + if @group + group_students = @course.members.where(:course_group_id => @group).joins("join users on members.user_id = users.id").select{|m| m.roles.to_s.include?("Student")} + + if group_students.empty? + student_in_group = '(-1)' else - course_group = CourseGroup.find_by_id(@select_group) - group_students = course_group.users - if group_students.empty? - student_in_group = '(0)' - else - student_in_group = '(' + group_students.map{ |user| user.id }.join(',') + ')' - end + student_in_group = '(' + group_students.map{ |member| member.user_id }.join(',') + ')' end - if @is_teacher || (!@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time <= Time.now) - @exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id in #{student_id} and user_id in #{student_in_group}"), @name + + if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id, :commit_status => 1).empty? && @exercise.score_open && @exercise.end_time <= Time.now) + @exercise_users_list = @exercise.exercise_users.where("user_id in #{student_in_group}").order("#{@order} #{@b_sort}") @show_all = true; - elsif !@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time > Time.now - @exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id = ? and user_id in #{student_id} and user_id in #{student_in_group}",User.current.id), @name + elsif !@exercise.exercise_users.where(:user_id => User.current.id, :commit_status => 1).empty? + @exercise_users_list = @exercise.exercise_users.where("user_id = ? and user_id in #{student_in_group}",User.current.id) else @exercise_users_list = [] end else - if @is_teacher || (!@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time <= Time.now) - @exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id in #{student_id}"), @name + if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id, :commit_status => 1).empty? && @exercise.score_open && @exercise.end_time <= Time.now) + @exercise_users_list = @exercise.exercise_users.where("user_id in #{student_id}").order("#{@order} #{@b_sort}") @show_all = true; - elsif !@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time > Time.now - @exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id = ? and user_id in #{student_id}",User.current.id), @name + elsif User.current.member_of_course?(@course) + @exercise_users_list = @exercise.exercise_users.where("user_id = ? and user_id in #{student_id}",User.current.id) else @exercise_users_list = [] end end - @exercise_count = @exercise.exercise_users.where("commit_status = 1 and user_id in #{student_id}").count - @left_nav_type = 8 + + unless @comment.blank? + if @comment.include?('0') + @exercise_users_list = @exercise_users_list.where(:subjective_score => -1) + else + @exercise_users_list = @exercise_users_list.where("subjective_score != -1") + end + end + + unless @status.blank? + @exercise_users_list = @exercise_users_list.where(:commit_status => @status) + end + + @exercise_users_list = search_exercise_member @exercise_users_list, @name + + @score = @b_sort == "desc" ? "asc" : "desc" + @exercise_count = @exercise_users_list.count + @has_commit_count = @exercise.exercise_users.where(:commit_status => 1).count + @no_group_count = @course.members.where(:course_group_id => 0).select{|m| m.roles.to_s.include?("Student")}.count + @limit = 50 + @is_remote = true + @page = (params['page'] || 1).to_i + @exercise_pages = Paginator.new @exercise_count, @limit, @page + @offset ||= @exercise_pages.offset + @exercise_users_list = paginateHelper @exercise_users_list, @limit respond_to do |format| format.js - format.html + format.html{render :layout => 'base_edu'} format.xls { - filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@exercise.exercise_name}#{l(:excel_exercise_list)}.xls" + filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@exercise.exercise_name}#{l(:excel_exercise_list)}.xls" send_data(exercise_to_xls(@exercise_users_list), :type => "text/excel;charset=utf-8; header=present", :filename => filename_for_content_disposition(filename)) } @@ -690,11 +689,11 @@ class ExerciseController < ApplicationController else # 更新提交状态 cur_exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", User.current, @exercise.id).first - cur_exercise_user.update_attributes(:status => 1, :commit_status => 1) - if @exercise.time && @exercise.time != -1 + cur_exercise_user.update_attributes(:status => 1, :commit_status => 1, :end_at => Time.now) + #if @exercise.time && @exercise.time != -1 score = calculate_student_score(@exercise, User.current) - cur_exercise_user.update_attributes(:score => score) - end + cur_exercise_user.update_attributes(:objective_score => score, :score => score + (cur_exercise_user.subjective_score > 0 ? cur_exercise_user.subjective_score : 0)) + #end # 答题过程中需要统计完成量 #@uncomplete_question = get_uncomplete_question(@exercise, User.current) # 获取改学生的考试得分 @@ -748,16 +747,20 @@ class ExerciseController < ApplicationController #查看学生的答卷情况 def show_student_result - @user = User.find params[:user_id] - @can_edit_excercise = false - @exercise_questions = @exercise.exercise_questions - #score = calculate_student_score(@exercise, @user) - #eu = get_exercise_user(@exercise.id, @user.id) - #eu.update_attributes(:score => score) - @exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first - @left_nav_type = 8 - respond_to do |format| - format.html {render :layout => 'base_courses'} + @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? + if @is_teacher || (User.current.member_of_course?(@exercise.course) && @exercise.exercise_status > 2) + @user = User.find params[:user_id] + #@can_edit_excercise = false + @exercise_questions = @exercise.exercise_questions + #score = calculate_student_score(@exercise, @user) + #eu = get_exercise_user(@exercise.id, @user.id) + #eu.update_attributes(:score => score) + @exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first + respond_to do |format| + format.html {render :layout => 'base_edu'} + end + else + render_403 end end @@ -937,7 +940,7 @@ class ExerciseController < ApplicationController else name = name.downcase select_exercises = exercises.select{ |exercise| - exercise.user[:login].to_s.downcase.include?(name) || exercise.user.user_extensions[:student_id].to_s.downcase.include?(name) || (exercise.user[:lastname].to_s.downcase + exercise.user[:firstname].to_s.downcase).include?(name) + exercise.user.user_extensions[:student_id].to_s.downcase.include?(name) || (exercise.user[:lastname].to_s.downcase + exercise.user[:firstname].to_s.downcase).include?(name) } end select_exercises diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 122d74478..43523a130 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -33,6 +33,18 @@ module ApplicationHelper extend Forwardable def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter + # 作品列表的提交状态 + def list_work_status status + case status + when 0 + str = "未提交" + when 1 + str = "按时提交" + when 2 + str = "延时提交" + end + end + # 定义当前关卡是否有权开启下一关 # :实训若发布了,必须通过当前关卡才能查看下一关 # :未发布的实训,除了最后一关,其它的关卡都可以进入下一关 @@ -546,7 +558,7 @@ module ApplicationHelper style = 'edu-filter-btn-red' when '评阅中' style = 'edu-filter-btn-green' - when '已结束' + when '已结束', '已截止' style = 'edu-filter-btn-end' when '已开启补交' style = 'edu-filter-btn-late' @@ -568,9 +580,10 @@ module ApplicationHelper # 未评阅 def had_unevaluate_count homework_common - count = StudentWorksScore.find_by_sql("SELECT count(distinct student_work_id) as count FROM student_works_scores sws, student_works sw, homework_commons hc where hc.id =#{homework_common.id} and sw.homework_common_id=hc.id and sw.is_delete = 0 and sws.student_work_id = sw.id and sws.user_id=#{User.current.id};").first.try(:count).to_i - student_count = homework_common.course.student.count - return student_count - count + #count = StudentWorksScore.find_by_sql("SELECT count(distinct student_work_id) as count FROM student_works_scores sws, student_works sw, homework_commons hc where hc.id =#{homework_common.id} and sw.homework_common_id=hc.id and sw.is_delete = 0 and sws.student_work_id = sw.id and sws.user_id=#{User.current.id};").first.try(:count).to_i + has_comment = User.current.student_works_scores.where(:student_work_id => homework_common.student_works.map(&:id), :reviewer_role => [1, 2]).group_by(&:student_work_id).count + student_count = homework_common.student_works.count + return student_count - has_comment end # 该阶段还有多长时间结束/距下一阶段还有多长时间 @@ -616,6 +629,28 @@ module ApplicationHelper result end + # 试卷:该阶段还有多长时间结束/距下一阶段还有多长时间 + def exercise_curr_time exercise + result = {} + status = "" + time = "" + case exercise.exercise_status + when 1 + status = "未发布" + when 2 + if exercise.end_time && exercise.end_time >= Time.now + status = "提交中" + time = how_much_time(exercise.end_time) + end + when 3 + status = "已截止" + time = format_time exercise.end_time + end + result[:status] = status + result[:time] = time + result + end + # 公共分页 def paginator_list objs, objs_count, limit, is_remote @is_remote = is_remote @@ -4760,9 +4795,19 @@ def get_work_index(hw,is_teacher) return index end +def get_ex_index(exercise, course, is_teacher) + if is_teacher + exercises = course.exercises.order("created_at asc") + else + exercises = course.exercises.where("exercise_status > 0").order("created_at asc") + end + ex_ids = exercises.map{|ex| ex.id} if !exercises.blank? + index = ex_ids.index(exercise.id) + return index +end + def get_hw_index(hw,is_teacher,type=0) homework_commons = hw.course.homework_commons - Rails.logger.info("----------------------------------------------"+hw.course.to_s) if is_teacher if type != 0 homeworks = homework_commons.where("homework_commons.homework_type = #{type}").order("created_at asc") @@ -4776,7 +4821,6 @@ def get_hw_index(hw,is_teacher,type=0) homeworks = homework_commons.where("publish_time <= '#{Time.now}'").order("created_at asc") end end - Rails.logger.info("----------------------------------------------"+homeworks.count.to_s) hw_ids = homeworks.map{|hw| hw.id} if !homeworks.blank? index = hw_ids.index(hw.id) return index diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb index 28dd0b260..203ffd327 100644 --- a/app/helpers/exercise_helper.rb +++ b/app/helpers/exercise_helper.rb @@ -1,6 +1,44 @@ # encoding: utf-8 module ExerciseHelper + def un_commit_num exercise + course = exercise.course + exercise.exercise_users.where(:commit_status => 0, :user_id => course.student.map(&:student_id)).count + end + + def has_commit_num exercise + course = exercise.course + exercise.exercise_users.where(:commit_status => 1, :user_id => course.student.map(&:student_id)).count + end + + def un_comment_num exercise + course = exercise.course + exercise.exercise_users.where(:commit_status => 1, :user_id => course.student.map(&:student_id), :subjective_score => -1).count + end + + def has_comment_num exercise + course = exercise.course + exercise.exercise_users.where(:commit_status => 1, :user_id => course.student.map(&:student_id)).count - exercise.exercise_users.where(:commit_status => 1, :user_id => course.student.map(&:student_id), :subjective_score => -1).count + end + + def answer_is_correct eq, user + is_correct = false + case eq.question_type + when 1 + answer = get_user_answer(eq, user) + standard_answer = get_user_standard_answer(eq, user) + is_correct = !answer.empty? && !standard_answer.empty? && answer.first.exercise_choice.choice_position == standard_answer.first.exercise_choice_id + when 2 + standard_answer = get_user_standard_answer(eq, user) + is_correct = !standard_answer.empty? && get_mulscore(eq, user).to_i == standard_answer.first.exercise_choice_id + when 3 + answer = get_user_answer(eq, user) + standard_answer = get_user_standard_answer(eq, user) + is_correct = !answer.empty? && !standard_answer.empty? && standard_answer.include?(answer.first.answer_text) + end + is_correct + end + # 单选 def sigle_selection_standard_answer(params) size = params.ord - 96 @@ -160,6 +198,17 @@ module ExerciseHelper uncomplete_question end + def question_commit_status question, user + status = "" + case question.question_type + when 3, 4 + get_anwser_vote_text(question.id,user.id) == "" ? status = "未答" : status = "" + when 1, 2 + get_user_answer(question,user).empty? ? status = "未答" : status = "" + end + status + end + #获取文本题答案 def get_anwser_vote_text(question_id,user_id) pv = ExerciseAnswer.find_by_exercise_question_id_and_user_id(question_id,user_id) diff --git a/app/helpers/owner_type_helper.rb b/app/helpers/owner_type_helper.rb index 3239d9d8e..b4fb514c9 100644 --- a/app/helpers/owner_type_helper.rb +++ b/app/helpers/owner_type_helper.rb @@ -16,4 +16,5 @@ module OwnerTypeHelper STUDENTWORK = 15 HOMEWORKBANK = 16 SUBJECT = 17 + EXERCISEQUESTION = 18 end \ No newline at end of file diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index b016bbf61..9b3c17a95 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -85,18 +85,6 @@ module StudentWorkHelper str end - # 作品列表的提交状态 - def list_work_status status - case status - when 0 - str = "未提交" - when 1 - str = "按时提交" - when 2 - str = "延时提交" - end - end - # 作品的助教评分模式 def ta_score_mode homework mode = homework.homework_detail_manual.ta_mode == 1 ? '平均' : '复审' diff --git a/app/models/exercise_question.rb b/app/models/exercise_question.rb index 5189b0274..c6a4f40df 100644 --- a/app/models/exercise_question.rb +++ b/app/models/exercise_question.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class ExerciseQuestion < ActiveRecord::Base include Redmine::SafeAttributes @@ -5,4 +6,17 @@ class ExerciseQuestion < ActiveRecord::Base has_many :exercise_choices, :order => "#{ExerciseChoice.table_name}.choice_position",:dependent => :destroy has_many :exercise_answers, :dependent => :destroy has_many :exercise_standard_answers, :dependent => :destroy + + def question_type_name + case self.question_type + when 1 + "单选题" + when 2 + "多选题" + when 3 + "填空题" + when 4 + "简答题" + end + end end diff --git a/app/models/students_for_course.rb b/app/models/students_for_course.rb index 95157f2da..662d57bd2 100644 --- a/app/models/students_for_course.rb +++ b/app/models/students_for_course.rb @@ -10,7 +10,7 @@ class StudentsForCourse < ActiveRecord::Base validates_uniqueness_of :student_id, :scope => :course_id after_destroy :delete_student_works, :delete_course_homework_statistic - after_create :recovery_student_works, :create_student_works + after_create :recovery_student_works, :create_student_works, :create_exercise_users #退出班级或删除学生时隐藏学生的作品 def delete_student_works @@ -58,6 +58,27 @@ class StudentsForCourse < ActiveRecord::Base end end + # 加入班级时创建已发布试卷的作品 + def create_exercise_users + course = self.course + str = "" + exercises = course.exercises.where("exercise_status > 0") + if exercises.count != 0 + exercises.each do |ex| + if ex.exercise_users.where("user_id = #{self.student_id}").count == 0 + if str != "" + str += "," + end + str += "(#{ex.id},#{self.student_id}, 0, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" + end + end + if str != "" + sql = "insert into exercise_users (exercise_id, user_id, commit_status, created_at, updated_at) values" + str + ActiveRecord::Base.connection.execute sql + end + end + end + #加入班级时创建一条记录 def create_course_homework_statistic # if CourseHomeworkStatistics.where(:user_id => self.student_id, :course_id => self.course_id).count == 0 diff --git a/app/views/exercise/_edit_MC.html.erb b/app/views/exercise/_edit_MC.html.erb index 9dbb510b2..6d49b607d 100644 --- a/app/views/exercise/_edit_MC.html.erb +++ b/app/views/exercise/_edit_MC.html.erb @@ -21,6 +21,47 @@ } +
+
+
+

单选题

+ +
+
  • + + + + +
  • + <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> +
  • + + + +
  • +
    + <% end %> +
  • + + +
  • +
  • + + + +

    + 温馨提示:[单选题]属于客观题将由系统自动评分,请设置标准答案 + 保存 + 取消 +

    +
  • +
    +
    +<% if false %>
    @@ -65,4 +106,5 @@
    +<% end%> <% end%> \ No newline at end of file diff --git a/app/views/exercise/_edit_MCQ.html.erb b/app/views/exercise/_edit_MCQ.html.erb index a9790c470..bf6d672f1 100644 --- a/app/views/exercise/_edit_MCQ.html.erb +++ b/app/views/exercise/_edit_MCQ.html.erb @@ -20,7 +20,54 @@ "
    "); } +
    +
    +
    +

    多选题

    + + + + +
    +
  • + + + + +
  • + <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> +
  • + + + +
  • +
    + <% end %> + + +
  • + + +
  • + +
  • + + + +

    + 温馨提示:[多选题]属于客观题将由系统自动评分,请设置标准答案 + 保存 + 取消 +

    +
  • +
    +
    +<% if false %>
    @@ -67,4 +114,5 @@
    + <% end %> <% end%> \ No newline at end of file diff --git a/app/views/exercise/_edit_head.html.erb b/app/views/exercise/_edit_head.html.erb index 6c8e165a0..1aa23f3d8 100644 --- a/app/views/exercise/_edit_head.html.erb +++ b/app/views/exercise/_edit_head.html.erb @@ -1,41 +1,12 @@ -<%= form_for @exercise, :remote=>true do |f| %> -
    -
    - -
    - -
    - "/> - <%= calendar_for('exercise_end_time')%> -
    -
    测验时长:分钟
    - -
    - "/> - <%= calendar_for('exercise_publish_time')%> -
    -
    - - -
    +<%= form_for(@exercise, :html => {:multipart => true, :id => "exercise_head_form"}, :remote => true) do |f| %> +
    +
    -<% end %> - \ No newline at end of file +
    + +
    +

    + 保存 + 取消 +

    +<% end %> \ No newline at end of file diff --git a/app/views/exercise/_edit_multi.html.erb b/app/views/exercise/_edit_multi.html.erb index 2e2721282..e56fa4c32 100644 --- a/app/views/exercise/_edit_multi.html.erb +++ b/app/views/exercise/_edit_multi.html.erb @@ -7,6 +7,33 @@ } +
    +

    简答题

    + + +
  • + + + +
  • +
  • + + +
  • +
  • + + + +

    + 温馨提示:[简答题]属于主观题需要人工评分,未作答的情况下系统将自动评分 +   参考答案仅作为人工评分的参考 + 保存 + 取消 +

    +
  • +
    + +<% if false %>
    @@ -36,4 +63,5 @@
    +<% end%> <% end%> \ No newline at end of file diff --git a/app/views/exercise/_edit_single.html.erb b/app/views/exercise/_edit_single.html.erb index 661ff12af..42f2735fe 100644 --- a/app/views/exercise/_edit_single.html.erb +++ b/app/views/exercise/_edit_single.html.erb @@ -1,5 +1,6 @@ <%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%> + <% if false %> - -
    -
    - - 分 -
    -
    -
    - + <% end %> +
    +

    填空题

    +
  • + + + - -
  • - -
    -
      -
      - <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %> -
    • - - - -
    • -
      - <% end %> -
    • -
      新建参考答案
      -
    • -
      -
      + + + <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %> +
    • + + + +
    • -
    -
    - -
    + <% end %> + + +
  • + + +
  • + +
  • + + + +

    + 温馨提示:[填空题]属于客观题将由系统自动评分,请设置标准答案 + 保存 + 取消 +

    +
  • - -<% end%> \ No newline at end of file +<% end %> \ No newline at end of file diff --git a/app/views/exercise/_edu_edit_form.html.erb b/app/views/exercise/_edu_edit_form.html.erb new file mode 100644 index 000000000..13df8ea2a --- /dev/null +++ b/app/views/exercise/_edu_edit_form.html.erb @@ -0,0 +1,261 @@ +<% content_for :header_tags do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> +<% end %> +
    +
    + <%= render :partial => 'show_head', :locals => {:exercise => @exercise} %> +
    +
    + <% if is_edit %> + <%= render :partial => 'edit_head', :locals => {:exercise => @exercise} %> + <% else %> + <%= render :partial => 'new_head', :locals => {:exercise => @exercise} %> + <% end %> +
    +
    + +
    + <%= render :partial => "exercise/total_questions_score" %> +
    + +
    + <% if is_edit %> + <%= render :partial => "exercise/exercise_content" %> + <% end %> +
    + +
    + <%= render :partial => "exercise/new_question" %> +
    + +
    + +
    + + + + + + + + \ No newline at end of file diff --git a/app/views/exercise/_exercise_content.html.erb b/app/views/exercise/_exercise_content.html.erb index 92cc2f0dd..ed43bff31 100644 --- a/app/views/exercise/_exercise_content.html.erb +++ b/app/views/exercise/_exercise_content.html.erb @@ -1,56 +1,34 @@ -<% mc_question_list = exercise.exercise_questions.where("question_type=1") %> -<% mcq_question_list = exercise.exercise_questions.where("question_type=2") %> -<% single_question_list = exercise.exercise_questions.where("question_type=3") %> -<% multi_question_list = exercise.exercise_questions.where("question_type=4") %> -
    "> -

    单选题

    - <% mc_question_list.each_with_index do |exercise_question, index| %> -
    -
    - <%= render :partial => 'show_MC', :locals => {:exercise_question => exercise_question} %> -
    - -
    - <% end %> -
    -
    "> -

    多选题

    - <% mcq_question_list.each_with_index do |exercise_question, index| %> -
    -
    - <%= render :partial => 'show_MCQ', :locals => {:exercise_question => exercise_question} %> -
    - -
    - <% end %> -
    -
    "> -

    填空题

    - <% single_question_list.each_with_index do |exercise_question, index| %> -
    -
    - <%= render :partial => 'show_single', :locals => {:exercise_question => exercise_question} %> -
    - -
    - <% end %> -
    -
    "> -

    问答题

    - <% multi_question_list.each_with_index do |exercise_question, index| %> -
    -
    - <%= render :partial => 'show_multi', :locals => {:exercise_question => exercise_question} %> -
    - -
    - <% end %> -
    \ No newline at end of file +<% @exercise.exercise_questions.each do |eq| %> +
    + <% case eq.question_type %> + <% when 1 %> +
    + <%= render :partial => 'show_MC', :locals => {:exercise_question => eq} %> +
    + + <% when 2 %> +
    + <%= render :partial => 'show_MCQ', :locals => {:exercise_question => eq} %> +
    + + <% when 3 %> +
    + <%= render :partial => 'show_single', :locals => {:exercise_question => eq} %> +
    + + <% when 4 %> +
    + <%= render :partial => 'show_multi', :locals => {:exercise_question => eq} %> +
    + + <% end %> +
    +<% end %> \ No newline at end of file diff --git a/app/views/exercise/_exercise_index_tab.html.erb b/app/views/exercise/_exercise_index_tab.html.erb new file mode 100644 index 000000000..a9ae2f47a --- /dev/null +++ b/app/views/exercise/_exercise_index_tab.html.erb @@ -0,0 +1,21 @@ +

    + edu-filter-cir-grey mr5 font-12 fl" data-remote="true">全部 + <% if @is_teacher %> + edu-filter-cir-grey mr5 font-12 fl" data-remote="true">未发布 + <% end %> + edu-filter-cir-grey mr5 font-12 fl" data-remote="true">提交中 + edu-filter-cir-grey mr5 font-12 fl" data-remote="true">已截止 + + +

    +
    + <%= form_tag(exercise_index_path(:course_id => @course.id, :type => @type), :remote => true , :method => 'get', :id => 'exercise_search_form') do %> +
    +
    + + +
    + +
    + <% end %> +
    \ No newline at end of file diff --git a/app/views/exercise/_exercise_student.html.erb b/app/views/exercise/_exercise_student.html.erb index bae12dab5..d06dc69dc 100644 --- a/app/views/exercise/_exercise_student.html.erb +++ b/app/views/exercise/_exercise_student.html.erb @@ -3,7 +3,7 @@ $("#RSide").removeAttr("id"); $("#homework_page_right").css("min-height",$("#courseLSide").height()-33); $("#Container").css("width","1000px"); - var end_time = <%=exercise.end_time.to_i%>; + var end_time = <%=@exercise.end_time.to_i%>; getTime(end_time); /*start_time = new Date(); start_time.setFullYear(<%#=exercise_user.start_at.year%>); @@ -42,323 +42,237 @@ //} } -
    -
    -
    -

    <%= exercise.exercise_name%>

    - -
    - 开始时间:<%=Time.parse(h(exercise_user.start_at)).strftime("%Y-%m-%d %H:%M:%S")%> - 截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S")%> - <% unless exercise.time == -1 %> - 测验时长:<%=exercise.time %>分钟 - <% end %> - -
    -
    <%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%>
    -
    -
    - <% current_score = get_current_score exercise %> -
    - <%= render :partial => 'exercise/total_questions_score', :locals => {:exercise => exercise, :current_score => current_score} %> -
    +
    +

    + + <%= link_to @course.name, course_path(@course) %> > <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> > <%= link_to @exercise.exercise_name, student_exercise_list_exercise_path(@exercise) %> > <%= @exercise_user.user.show_real_name %> +

    +
    +

    + <% unless @exercise.is_public %> + + <% end %> + <%= @exercise.exercise_name %> +

    - <% mc_question_list = exercise.exercise_questions.where("question_type=1") %> - <% mcq_question_list = exercise.exercise_questions.where("question_type=2") %> - <% single_question_list = exercise.exercise_questions.where("question_type=3") %> - <% multi_question_list = exercise.exercise_questions.where("question_type=4") %> - <% if exercise.question_random == 1 %> - <% mc_question_list = mc_question_list.shuffle %> - <% mcq_question_list = mcq_question_list.shuffle %> - <% single_question_list = single_question_list.shuffle %> - <% multi_question_list =multi_question_list.shuffle %> - <% end %> -
    "> -

    单选题

    - <% mc_question_list.each_with_index do |exercise_question, list_index| %> -
    -
    -
    -
    - 第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分) -
    -
    -
    - - - <% exercise_choices = exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %> - <% exercise_choices.each_with_index do |exercise_choice,index| %> - - - - <% end %> - -
    - -
    -
    -
    -
    -
    - <% end %> -
    -
    "> -

    多选题

    - <% mcq_question_list.each_with_index do |exercise_question,list_index| %> -
    -
    -
    -
    - 第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分) -
    -
    -
    - - - <% exercise_choices = exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %> - <% exercise_choices.each_with_index do |exercise_choice,index| %> - - - - <% end %> - -
    - -
    -
    -
    -
    -
    - <% end %> -
    -
    "> -

    填空题

    - <% single_question_list.each_with_index do |exercise_question, list_index| %> -
    -
    -
    -
    - 第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分) -
    -
    -
    - - > -
    -
    -
    -
    - <% end %> -
    -
    "> -

    问答题

    - <% multi_question_list.each_with_index do |exercise_question, list_index| %> -
    -
    -
    -
    - 第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分) -
    -
    -
    - - -
    -
    -
    -
    - <% end %> -
    - -
    -

    答题情况

    -
    - 单选题: - <% mc_question_list.each_with_index do |exercise_question, list_index| %> - <%= list_index + 1 %> - <% end %> -
    -
    -
    - 多选题: - <% mcq_question_list.each_with_index do |exercise_question, list_index| %> - <%= list_index + 1 %> - <% end %> -
    -
    -
    - 填空题: - <% single_question_list.each_with_index do |exercise_question, list_index| %> - <%= list_index + 1 %> - <% end %> -
    -
    -
    - 问答题: - <% multi_question_list.each_with_index do |exercise_question, list_index| %> - <%= list_index + 1 %> - <% end %> -
    -
    -
    - - -
    - + <%= format_time @exercise_user.start_at %> 开始答题
    - + + <% unless @exercise.try(:exercise_description).nil? %> +
    +
    <%= @exercise.try(:exercise_description).html_safe%>
    +
    + <% end %> + +
    + <%= render :partial => "exercise/total_questions_score" %> +
    + +
    +
    + 已答 + 未答 +
    + <% if @exercise.question_random == 1 %> + <% question_list = @exercise.exercise_questions.shuffle %> + <% end %> + +
    + <% question_list.each_with_index do |eq, index| %> + <%= index + 1 %> + <% end %> +
    +
    +
    + <% question_list.each_with_index do |exercise_question, i| %> +
    +
    +

    第<%= i + 1 %>题:[<%= exercise_question.question_type_name %>]<%= exercise_question.question_score %>

    +
    +
    <%= exercise_question.question_title %>
    + <% case exercise_question.question_type %> + <% when 1 %> +
    + <% exercise_choices = @exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %> + <% exercise_choices.each_with_index do |exercise_choice,index| %> +
  • + + <%= answer_be_selected?(exercise_choice,User.current) ? "checked" : "" %>> + +
  • + <% end %> +
    + <% when 2 %> +
    + <% exercise_choices = @exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %> + <% exercise_choices.each_with_index do |exercise_choice,index| %> +
  • + + <%= answer_be_selected?(exercise_choice,User.current) ? "checked" : "" %>> + +
  • + <% end %> +
    + <% when 3 %> +
    + + +
    + <% when 4 %> +
    + + +
    + <% end %> +
    + <% end %> +
    + + <% if @can_edit_excercise %> +
    +

    + 交卷 +

    +
    + <% end %>
    + -
    -
    -
    -

    <%= exercise.exercise_name%>

    -
    - 开始时间:<%=Time.parse(h(exercise_user.start_at)).strftime("%Y-%m-%d %H:%M:%S") %> - 截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S")%> - <% unless exercise.time == -1 %> - 测验时长:<%=exercise.time %>分钟 + + +
    +

    + + <%= link_to @course.name, course_path(@course) %> > <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> > <%= link_to @exercise.exercise_name, student_exercise_list_exercise_path(@exercise) %> > <%= @exercise_user.user.show_real_name %> +

    +
    +

    + <% unless @exercise.is_public %> + + <% end %> + <%= @exercise.exercise_name %> +

    + + <%= link_to "返回", student_exercise_list_exercise_path(@exercise), :class => "fr font-12 mr15 mt3 color-grey" %> +
    + +<% unless @exercise.try(:exercise_description).nil? %> +
    +
    <%= @exercise.try(:exercise_description).html_safe%>
    +
    +<% end %> + +
    + <%= render :partial => "exercise/total_questions_score" %> +
    + +
    +
    + 客观题 + 正确 + 错误 +

    总分:<%= @exercise_user.score.nil? ? "--" : format("%.1f",@exercise_user.score)%>

    +
    +
    + <% @exercise.exercise_questions.where(:question_type => [1, 2, 3]).each_with_index do |eq, index| %> + <% is_correct = answer_is_correct(eq, user) %> + <%= eq.question_number %> + <% end %> +
    +
    + 主观题 + 已评 + 未评 +
    +
    + <% @exercise.exercise_questions.where(:question_type => 4).each_with_index do |eq, index| %> + <% ea = User.current.exercise_answer.where(:exercise_question_id => eq.id).first %> + <%= eq.question_number %> + <% end %> +
    + +
    +
    + <% @exercise.exercise_questions.each_with_index do |exercise_question, i| %> +
    +
    +

    第<%= exercise_question.question_number %>题:[<%= exercise_question.question_type_name %>]<%= exercise_question.question_score %>分<%= question_commit_status exercise_question, @exercise_user.user %>

    + <% if exercise_question.question_type != 4 %> + <% is_correct = answer_is_correct(exercise_question, user) %> +

    <%= is_correct ? exercise_question.question_score : 0 %>

    + <% else %> + <% answer = get_user_answer(exercise_question, user)%> +

    mr3"><%= answer.empty? ? 0 : (answer.first.score == -1 ? "未批" : answer.first.score) %><%= answer.empty? ? "分" : (answer.first.score == -1 ? "" : "分") %>

    <% end %> - <%# time = exercise_user.end_at - exercise_user.start_at %>
    -
    <%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%>
    -
    -
    -
    -
    得分:<%=exercise_user.score %>
    - <% if User.current.admin? || User.current.allowed_to?(:as_teacher,exercise.course) || (exercise.exercise_status == 3 && exercise.show_result == 1) %> - <%= link_to '返回统计结果>>',student_exercise_list_exercise_path(exercise.id,:course_id => exercise.course.id) , :class => "fr linkBlue" %> - <% end %> -
    -
    - <% mc_question_list = exercise.exercise_questions.where("question_type=1") %> - <% mcq_question_list = exercise.exercise_questions.where("question_type=2") %> - <% single_question_list = exercise.exercise_questions.where("question_type=3") %> - <% multi_question_list = exercise.exercise_questions.where("question_type=4") %> - -
    "> -

    单选题

    - <% mc_question_list.each_with_index do |exercise_question, list_index| %> -
    -
    -
    -
    -
    - 第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分   - 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> - -
    -
    -

    <%= exercise_question.question_title %>

    -
    - -
    -
    - - - <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> - - - - <% end %> - -
    - -
    -
    -
    +
    <%= exercise_question.question_title %>
    + <% case exercise_question.question_type %> + <% when 1 %> +
    + <% exercise_choices = @exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %> + <% exercise_choices.each_with_index do |exercise_choice,index| %> +
  • + > + +
  • + <% end %>
    -
    - <% end %> -
    - -
    "> -

    多选题

    - <% mcq_question_list.each_with_index do |exercise_question, list_index| %> -
    -
    -
    -
    -
    - 第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分   - 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> - -
    -
    -

    <%= exercise_question.question_title %>

    + <% if @is_teacher || @exercise.answer_open %> +
    + 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
    - -
    -
    - - - <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> - - - - <% end %> - -
    - -
    -
    -
    + <% end %> + <% when 2 %> +
    + <% exercise_choices = @exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %> + <% exercise_choices.each_with_index do |exercise_choice,index| %> +
  • + > + +
  • + <% end %>
    -
    - <% end %> -
    - -
    "> -

    填空题

    - <% single_question_list.each_with_index do |exercise_question,list_index| %> -
    -
    -
    -
    -
    - 第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分 - -
    -
    -

    <%= exercise_question.question_title %>

    + <% if @is_teacher || @exercise.answer_open %> +
    + 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
    - -
    -
    + <% end %> + <% when 3 %> + <% unless get_anwser_vote_text(exercise_question.id,user.id) == "" %> +
    <%= get_anwser_vote_text(exercise_question.id,user.id).html_safe %>
    + <% end %> + <% if @is_teacher || @exercise.answer_open %> +
    <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %> - 参考答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%>
    +

    候选答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%>

    <% end %>
    -
    - > + <% end %> + <% when 4 %> + <% unless get_anwser_vote_text(exercise_question.id,user.id) == "" %> +
    <%= get_anwser_vote_text(exercise_question.id,user.id).html_safe %>
    + <% end %> + <% if exercise_question.exercise_standard_answers.count > 0 && (@is_teacher || @exercise.answer_open) %> + -
    -
    -
    - <% end %> -
    - -
    "> -

    问答题

    - <% multi_question_list.each_with_index do |exercise_question, list_index| %> -
    -
    -
    -
    -
    - 第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分 - -
    +
    +

    参考答案

    +
    <%= exercise_question.exercise_standard_answers.first.answer_text%>
    +
    + <% end %> + <% if !answer.empty? && @is_teacher %> +
    +
    + + + + +
    +
    + 保存
    -

    <%= exercise_question.question_title %>

    -
    - <% if exercise_question.exercise_standard_answers.count > 0 %> -
    - 参考答案:
    <%= exercise_question.exercise_standard_answers.first.answer_text%>
    -
    - <% end %> -
    - -
    -
    -
    -
    - <% end %> -
    -
    - -
    - + <% end %> + <% end %> +
    + <% end %> +
    \ No newline at end of file diff --git a/app/views/exercise/_exercises_list.html.erb b/app/views/exercise/_exercises_list.html.erb index 787ef20b7..98732d61e 100644 --- a/app/views/exercise/_exercises_list.html.erb +++ b/app/views/exercise/_exercises_list.html.erb @@ -1,28 +1,66 @@ -
    -

    所有试卷 - (<%= @obj_count%>) -

    - <% if @is_teacher%> - <%= link_to "新建试卷 ", new_exercise_path(:course_id => @course.id), :class => "newbtn" %> - <%= link_to "导入试卷", other_exercise_exercise_index_path(:course_id => @course.id), :remote=>true,:class => "newbtn"%> - <% end%> -
    -
    -
    - <% if @exercises.count != 0 %> - <% @exercises.each_with_index do |exercise,index|%> -
      - <%= render :partial => 'exercise', :locals => {:exercise => exercise,:index => index} %> -
    -
    - <% end%> +<% if @exercises.count != 0 %> +
    + <% @exercises.each do |exercise| %> +
    +
    + # <%= get_ex_index(exercise, @course, @is_teacher) + 1 %> + <%= link_to exercise.exercise_name, student_exercise_list_exercise_path(exercise), :class => "edu-class-inner-list fl color-grey3" %> + <% unless exercise.is_public %> + + <% end %> + <% ex_curr_status = exercise_curr_time exercise %> + <% if ex_curr_status[:status] != "" %> + <%= ex_curr_status[:status] %> + <% end %> +
    +

    + 创建于<%=time_from_now exercise.created_at %> + 更新于<%=time_from_now exercise.updated_at %> + <%= exercise.exercise_users.where("commit_status = 1").count %>已答 + <%= exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count %>未答 + <%# count = exercise.exercise_users.where("commit_status = 1 and subjective_score = -1").count %> + <%= un_commit_num exercise %>未评 + <%= ex_curr_status[:time] %> + <% if exercise.try(:exercise_status) == 0 && exercise.publish_time %> + 将于 <%= format_time(exercise.publish_time).to_s %> 发布 + <% end %> +

    +
    +
    + +
      + <% if @is_teacher %> + <% if exercise.exercise_status == 1 %> +
    • <%= link_to "编辑", edit_exercise_path(exercise) %>
    • + <% end %> + +
    • <%= link_to "设置", setting_exercise_path(exercise) %>
    • +
    • <%= link_to "导出成绩", student_exercise_list_exercise_path(exercise.id,:course_id => @course.id, :format => 'xls') %>
    • + <% unless exercise.is_public %> +
    • + 设为公开 +
    • + <% end %> + +
    • 删除
    • + <% else %> -
        - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> -
      - -
      - <% else %> - <%= render :partial => "welcome/no_data" %> - <% end %> -
    \ No newline at end of file + <% end %> + +
    +
    + <% end %> +
    +
    +
    +
      + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %> +
    +
    +
    +
    +<% else %> +
    + <%= render :partial => "welcome/no_data" %> +
    +<% end %> \ No newline at end of file diff --git a/app/views/exercise/_new_MC.html.erb b/app/views/exercise/_new_MC.html.erb index 1ff27f1fc..c8f2d5db6 100644 --- a/app/views/exercise/_new_MC.html.erb +++ b/app/views/exercise/_new_MC.html.erb @@ -1,70 +1,68 @@ -<%= form_for(ExerciseQuestion.new, - :html => { :multipart => true }, - :url=>create_exercise_question_exercise_path(exercise.id), - :remote=>true ) do |f| %> -
    -
    - <% score = exercise.exercise_questions.where("question_type=1").last.nil? ? "": exercise.exercise_questions.where("question_type=1").last.question_score %> - - 分 - 请点击选项 - 标准答案: -
    -
    -
    - - - -
    -
    -
      -
      - -
    • - A - - -
    • -
      -
    • - B - - -
    • -
      -
    • - C - - -
    • -
      -
    • - D - - -
    • -
      -
    • - E -
      新建选项
      -
    • -
      -
      -
      -
    -
    - -
    -
    +<% if exercise.id %> + <%= form_for(ExerciseQuestion.new, + :html => {:multipart => true}, + :url => create_exercise_question_exercise_path(exercise.id), + :remote => true ) do |f| %> +
    +
    +

    单选题

    + + + +
    +
  • + + +
  • + +
  • + + + +
  • +
  • + + + +
  • +
  • + + + +
  • +
  • + + +
  • +
  • + <% score = exercise.exercise_questions.where("question_type=1").last.nil? ? "": exercise.exercise_questions.where("question_type=1").last.question_score %> + + + +

    + 温馨提示:[单选题]属于客观题将由系统自动评分,请设置标准答案 + 保存 + 取消 +

    +
  • +
    +
    + <% end %> <% end %> \ No newline at end of file diff --git a/app/views/exercise/_new_MCQ.html.erb b/app/views/exercise/_new_MCQ.html.erb index cc1034070..3d4f37dd3 100644 --- a/app/views/exercise/_new_MCQ.html.erb +++ b/app/views/exercise/_new_MCQ.html.erb @@ -1,69 +1,65 @@ -<%= form_for(ExerciseQuestion.new, +<% if exercise.id %> + <%= form_for(ExerciseQuestion.new, :html => { :multipart => true }, :url=>create_exercise_question_exercise_path(exercise.id), :remote=>true ) do |f| %> -
    -
    - <% score = exercise.exercise_questions.where("question_type=2").last.nil? ? "": exercise.exercise_questions.where("question_type=2").last.question_score %> - - 分 - 请点击选项 - 标准答案: -
    -
    -
    - - - -
    -
    -
      -
      - -
    • - A - - +
      +
      +

      多选题

      + + + + +
      +
    • + +
    • -
      -
    • - B - - +
    • + + +
    • -
      -
    • - C - - +
    • + + +
    • -
      -
    • - D - - +
    • + + +
    • -
      -
    • - E -
      新建选项
      +
    • + +
    • -
      -
      -
    -
    - -
    -
    +
  • + <% score = exercise.exercise_questions.where("question_type=2").last.nil? ? "": exercise.exercise_questions.where("question_type=2").last.question_score %> + + + +

    + 温馨提示:[多选题]属于客观题将由系统自动评分,请设置标准答案 + 保存 + 取消 +

    +
  • +
    + <% end %> <% end %> \ No newline at end of file diff --git a/app/views/exercise/_new_head.html.erb b/app/views/exercise/_new_head.html.erb new file mode 100644 index 000000000..d651b3d0d --- /dev/null +++ b/app/views/exercise/_new_head.html.erb @@ -0,0 +1,17 @@ +<%= form_for(@exercise, + :html => {:multipart => true, :id => "exercise_head_form"}, + :url => {:controller => 'exercise', + :action => 'create', + :course_id => @course.id + }, + :method => :post, :remote => true) do |f| %> +
    + +
    +
    + +
    +

    + 保存 +

    +<% end %> \ No newline at end of file diff --git a/app/views/exercise/_new_multi.html.erb b/app/views/exercise/_new_multi.html.erb index 1baef7772..2ed014967 100644 --- a/app/views/exercise/_new_multi.html.erb +++ b/app/views/exercise/_new_multi.html.erb @@ -1,38 +1,39 @@ -<%= form_for(ExerciseQuestion.new, +<% if exercise.id %> + <%= form_for(ExerciseQuestion.new, :html => { :multipart => true }, :url=>create_exercise_question_exercise_path(exercise.id), :remote=>true ) do |f| %> -
    -
    - <% score = exercise.exercise_questions.where("question_type=4").last.nil? ? "": exercise.exercise_questions.where("question_type=4").last.question_score %> - - 分 -
    -
    -
    - - - -
    -
    -
    - - -
    -
    -
    - -
    -
    +
    +

    简答题

    + + +
  • + + +
  • +
  • + + +
  • +
  • + <% score = exercise.exercise_questions.where("question_type=4").last.nil? ? "": exercise.exercise_questions.where("question_type=4").last.question_score %> + + + +

    + 温馨提示:[简答题]属于主观题需要人工评分,未作答的情况下系统将自动评分 +   参考答案仅作为人工评分的参考 + 保存 + 取消 +

    +
  • +
    + <% end %> <% end %> \ No newline at end of file diff --git a/app/views/exercise/_new_question.html.erb b/app/views/exercise/_new_question.html.erb index 68d98eaca..307d6728f 100644 --- a/app/views/exercise/_new_question.html.erb +++ b/app/views/exercise/_new_question.html.erb @@ -1,57 +1,56 @@ - -
    +单选题 +多选题 +填空题 +简答题 \ No newline at end of file diff --git a/app/views/exercise/_show_MC.html.erb b/app/views/exercise/_show_MC.html.erb index 054f74ae0..dde727bca 100644 --- a/app/views/exercise/_show_MC.html.erb +++ b/app/views/exercise/_show_MC.html.erb @@ -1,137 +1,56 @@ -
    -
    -
    - 第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分   - 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> - -
    -
    -

    <%= exercise_question.question_title %>

    -
    - -
    - - - <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> - - - +
    +
    +

    第<%= exercise_question.question_number%>题:[单选题]<%= exercise_question.question_score %>

    +

    + <% if exercise_question.question_number < @exercise.exercise_questions.count %> + <% end %> -

    -
    - -
    + <% unless exercise_question.question_number == 1 %> + + <% end %> + + + +

    -
    +
    <%= exercise_question.question_title %>
    +
    + <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> +
  • + + +
  • + <% end %> +
    +
    + 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> +
    +
    + -
    +
    \ No newline at end of file diff --git a/app/views/exercise/_show_MCQ.html.erb b/app/views/exercise/_show_MCQ.html.erb index 6e9cbd256..d02c0b9ba 100644 --- a/app/views/exercise/_show_MCQ.html.erb +++ b/app/views/exercise/_show_MCQ.html.erb @@ -1,125 +1,46 @@ -
    -
    -
    - 第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分   - 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> - -
    -
    -

    <%= exercise_question.question_title %>

    -
    - -
    - - - <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> - - - +
    +
    +

    第<%= exercise_question.question_number%>题:[多选题]<%= exercise_question.question_score %>

    +

    + <% if exercise_question.question_number < @exercise.exercise_questions.count %> + <% end %> -

    -
    - -
    + <% unless exercise_question.question_number == 1 %> + + <% end %> + + + +

    -
    +
    <%= exercise_question.question_title %>
    +
    + <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> +
  • + + +
  • + <% end %> +
    +
    + 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> +
    +
    + -
    +
    \ No newline at end of file diff --git a/app/views/exercise/_show_head.html.erb b/app/views/exercise/_show_head.html.erb index 8fe5131b4..a392bce81 100644 --- a/app/views/exercise/_show_head.html.erb +++ b/app/views/exercise/_show_head.html.erb @@ -1,24 +1,15 @@ -
    - - -

    <%= exercise.exercise_name%>

    -
    - <% unless exercise.publish_time.nil? %> - 发布时间:<%=Time.parse(h(exercise.publish_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.publish_time%> - <% end %> - 截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.end_time %> - <% if exercise.time != -1 %> - 测验时长:<%= exercise.time %>分钟 - <% end %> -
    -
    <%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%>
    - -
    -
    \ No newline at end of file +
    +

    <%= @exercise.try(:exercise_name) %>

    + +
    +
    +
    +
    <%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description).html_safe%>
    +
    + + \ No newline at end of file diff --git a/app/views/exercise/_show_multi.html.erb b/app/views/exercise/_show_multi.html.erb index 8a0c4fa60..de1ee620b 100644 --- a/app/views/exercise/_show_multi.html.erb +++ b/app/views/exercise/_show_multi.html.erb @@ -1,83 +1,39 @@ -
    -
    -
    - 第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分 - -
    -
    -

    <%= exercise_question.question_title %>

    +
    +
    +

    第<%= exercise_question.question_number%>题:[简答题]<%= exercise_question.question_score %>

    +

    + <% if exercise_question.question_number < @exercise.exercise_questions.count %> + + <% end %> + <% unless exercise_question.question_number == 1 %> + + <% end %> + + + +

    +
    +
    <%= exercise_question.question_title %>
    +
    +

    参考答案

    +

    <%= exercise_question.exercise_standard_answers.count > 0 ? exercise_question.exercise_standard_answers.first.answer_text : "无"%>

    - - <% if exercise_question.exercise_standard_answers.count > 0 %> -
    - 参考答案:
    <%= exercise_question.exercise_standard_answers.first.answer_text%>
    -
    - <% end %>
    + -
    +
    \ No newline at end of file diff --git a/app/views/exercise/_show_single.html.erb b/app/views/exercise/_show_single.html.erb index d3298a5b9..39520d7de 100644 --- a/app/views/exercise/_show_single.html.erb +++ b/app/views/exercise/_show_single.html.erb @@ -1,105 +1,40 @@ -
    -
    -
    - 第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分 - -
    -
    -

    <%= exercise_question.question_title %>

    +
    +
    +

    第<%= exercise_question.question_number%>题:[填空题]<%= exercise_question.question_score %>

    +

    + <% if exercise_question.question_number < @exercise.exercise_questions.count %> + + <% end %> + <% unless exercise_question.question_number == 1 %> + + <% end %> + + + +

    - -
    +
    <%= exercise_question.question_title %>
    +
    <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %> - 参考答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%>
    +

    候选答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%>

    <% end %>
    + -
    +
    \ No newline at end of file diff --git a/app/views/exercise/_student_exercise.html.erb b/app/views/exercise/_student_exercise.html.erb index 04d874000..ef0daf3f9 100644 --- a/app/views/exercise/_student_exercise.html.erb +++ b/app/views/exercise/_student_exercise.html.erb @@ -1,30 +1,88 @@ -
    - - 测验 - - (<%= @exercise_count%>人已答) - - - <%if @is_teacher || @exercise.exercise_status == 3%> -
    - - -
    - <%= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@select_group), {:class => "classSplit"}) unless course_group_list(@course).empty? %> - <% end %> - +
    + <%= link_to "提交时间排序", student_exercise_list_exercise_path(@exercise, :order => "end_at", :sort => @score, :name => @name, :ex_group => @group, :ex_comment => @comment, :ex_status => @status), :class => "#{@order == 'end_at' ? 'color-orange03' : ''} fl ml15", :remote => true %> + | + <%= link_to "最终成绩排序", student_exercise_list_exercise_path(@exercise, :order => "score", :sort => @score, :name => @name, :ex_group => @group, :ex_comment => @comment, :ex_status => @status), :class => "#{@order == 'score' ? 'color-orange03' : ''} fl", :remote => true %> +

    <%= @exercise_count %> 个检索结果(学生:<%= @course.student.count %>人)

    +
    + + + + + + + + + + + + + + + + + <% @exercise_users_list.each_with_index do |exercise, index| %> + + + + + + + + + + + + + + + + + + + + + <% end %> + +
    序号姓名学号提交状态提交时间客观题得分主观题教师评分最终成绩操作
    <%= (@page - 1) * @limit + index + 1 %> + <%= link_to exercise.user.show_real_name, user_path(exercise.user),:class=>"color-grey3" %> + "> + <%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id %> + + <%= (list_work_status exercise.commit_status).html_safe %> + <%= exercise.commit_status == 0 ? '--' : format_time(exercise.end_at) %> + <%= exercise.objective_score == -1 ? "--" : format("%.1f",exercise.objective_score)%> + + <%= exercise.subjective_score == -1 ? "--" : format("%.1f",exercise.subjective_score)%> + + <%= exercise.score.nil? ? "--" : format("%.1f",exercise.score)%> + <%# unless exercise.score.nil? %> + + + + + + + + + + <%# end %> + + <% if exercise.commit_status > 0 %> + <% if @is_teacher %> + <%= link_to '评阅', show_student_result_exercise_path(@exercise,:user_id => exercise.user_id), :target => "_blank" %> + <% else %> + <%= link_to '查看', exercise.commit_status == 1 ? exercise_path(@exercise,:user_id => exercise.user_id) : show_student_result_exercise_path(@exercise,:user_id => exercise.user_id), :target => "_blank" %> + <% end %> + <% else %> + -- + <% end %> +
    -
    - - -

    客观题由系统自动评分:
    - 单选题、多选题、填空题

    主观题需要人工评分,但未作答时系统
    自动评零分:
    问答题 -

    +
    +
    +
      + <%= pagination_links_full @exercise_pages, @exercise_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> +
    +
    -
    -
    - -
    - <%= render :partial => "student_table" %> -
    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/app/views/exercise/_total_questions_score.html.erb b/app/views/exercise/_total_questions_score.html.erb index bd6bc291a..6119a820a 100644 --- a/app/views/exercise/_total_questions_score.html.erb +++ b/app/views/exercise/_total_questions_score.html.erb @@ -1,8 +1,12 @@ -
    " id="current_score_div"> - 单选题 <%= exercise.exercise_questions.where("question_type=1").count %> 题,共<%= current_score[1] %>分 - 多选题 <%= exercise.exercise_questions.where("question_type=2").count %> 题,共<%= current_score[2] %>分 - 填空题 <%= exercise.exercise_questions.where("question_type=3").count %> 题,共<%= current_score[3] %>分 - 问答题 <%= exercise.exercise_questions.where("question_type=4").count %> 题,共<%= current_score[4] %>分 - 合计 <%= exercise.exercise_questions.count %> 题,共<%= current_score[0] %> -
    +<% current_score = get_current_score @exercise %> +
    "> +

    + 单选题 <%= @exercise.exercise_questions.where("question_type=1").count %> 题,共 <%= current_score[1] %>  + 多选题 <%= @exercise.exercise_questions.where("question_type=2").count %> 题,共 <%= current_score[2] %>  + 填空题 <%= @exercise.exercise_questions.where("question_type=3").count %> 题,共 <%= current_score[3] %>  + 简答题 <%= @exercise.exercise_questions.where("question_type=4").count %> 题,共 <%= current_score[4] %>  +

    + + 合计 <%= @exercise.exercise_questions.count %> 题,共 <%= current_score[0] %>  +
    \ No newline at end of file diff --git a/app/views/exercise/commit_exercise.js.erb b/app/views/exercise/commit_exercise.js.erb index d91806fbb..8633682ba 100644 --- a/app/views/exercise/commit_exercise.js.erb +++ b/app/views/exercise/commit_exercise.js.erb @@ -1 +1 @@ -notice_box_redirect("<%= exercise_index_path(:course_id => @course.id) %>", "提交成功"); \ No newline at end of file +notice_box_redirect("<%= student_exercise_list_exercise_path(@exercise) %>", "提交成功"); \ No newline at end of file diff --git a/app/views/exercise/create.js.erb b/app/views/exercise/create.js.erb index 65b8dd327..1ad55e671 100644 --- a/app/views/exercise/create.js.erb +++ b/app/views/exercise/create.js.erb @@ -1,4 +1,5 @@ -$("#polls_head_show").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:exercise => @exercise}) %>"); -$("#polls_head_edit").html("<%= escape_javascript(render :partial => 'edit_head', :locals => {:exercise => @exercise}) %>"); -$("#polls_head_edit").hide(); -$("#polls_head_show").show(); \ No newline at end of file +$("#exercise_head_show").html("<%= escape_javascript(render :partial => 'show_head') %>"); +$("#exercise_head_edit").html("<%= escape_javascript(render :partial => 'edit_head') %>"); +$("#exercise_head_edit").hide(); +$("#exercise_head_show").show(); +$("#new_exercise_question").html("<%= escape_javascript(render :partial => 'exercise/new_question') %>"); \ No newline at end of file diff --git a/app/views/exercise/create_exercise_question.js.erb b/app/views/exercise/create_exercise_question.js.erb index 09878440c..8ccc46e94 100644 --- a/app/views/exercise/create_exercise_question.js.erb +++ b/app/views/exercise/create_exercise_question.js.erb @@ -1,54 +1,4 @@ -<% if @is_insert %> - $("#poll_content").html('<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise})%>'); - $("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>"); - <% current_score = get_current_score @exercise %> - $("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score', :locals => {:exercise => @exercise, :current_score => current_score}) %>"); -<% else %> + $("#exercise_question_list").html("<%= escape_javascript(render :partial => 'exercise/exercise_content') %>"); + $("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score') %>"); $("#new_exercise_question").html('<%= escape_javascript(render :partial => 'new_question', :locals => {:exercise => @exercise}) %>'); - $("#new_poll_question").html(""); - $("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>"); - <%if @exercise_questions.question_type == 1%> - $("#mc_question_list>div").last().children().first().addClass("border_b"); - $("#mc_question_list").show().append("
    " + - "
    " + - "<%= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @exercise_questions}) %>" + - "
    " + - "" + - "
    "); - <% end %> - <%if @exercise_questions.question_type == 2%> - $("#mcq_question_list").show().append("
    " + - "
    " + - "<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" + - "
    " + - "" + - "
    "); - <% end %> - <%if @exercise_questions.question_type == 3%> - $("#single_question_list").show().append("
    " + - "
    " + - "<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_questions}) %>" + - "
    " + - "" + - "
    "); - <% end %> - <%if @exercise_questions.question_type == 4%> - $("#multi_question_list").show().append("
    " + - "
    " + - "<%= escape_javascript(render :partial => 'show_multi', :locals => {:exercise_question => @exercise_questions}) %>" + - "
    " + - "" + - "
    "); - <% end %> -$("#total_questions_score").show(); -<% current_score = get_current_score @exercise %> -$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score', :locals => {:exercise => @exercise, :current_score => current_score}) %>"); -<% end %> + $("#new_poll_question").html(""); \ No newline at end of file diff --git a/app/views/exercise/delete_exercise_question.js.erb b/app/views/exercise/delete_exercise_question.js.erb index 0d20f1ccb..88e8297d2 100644 --- a/app/views/exercise/delete_exercise_question.js.erb +++ b/app/views/exercise/delete_exercise_question.js.erb @@ -1,5 +1,3 @@ hideModal(); -$("#poll_content").html("<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise}) %>"); -<% current_score = get_current_score @exercise %> -$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score', :locals => {:exercise => @exercise, :current_score => current_score}) %>"); -$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>"); \ No newline at end of file +$("#exercise_question_list").html("<%= escape_javascript(render :partial => 'exercise/exercise_content') %>"); +$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score') %>"); \ No newline at end of file diff --git a/app/views/exercise/destroy.js.erb b/app/views/exercise/destroy.js.erb deleted file mode 100644 index 82fbc95b3..000000000 --- a/app/views/exercise/destroy.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -hideModal(); -$("#exercise").html("<%= escape_javascript(render :partial => 'exercises_list') %>"); \ No newline at end of file diff --git a/app/views/exercise/edit.html.erb b/app/views/exercise/edit.html.erb index 48d307c78..18b73f51d 100644 --- a/app/views/exercise/edit.html.erb +++ b/app/views/exercise/edit.html.erb @@ -1,9 +1,15 @@ -<%= render :partial => 'exercise_form'%> - +<%#= render :partial => 'exercise_form'%> +
    +

    + + <%= link_to @course.name, course_path(@course) %> > <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> > <%= link_to @exercise.exercise_name, student_exercise_list_exercise_path(@exercise) %> > 编辑 +

    +
    +

    编辑试卷

    + <%= link_to "返回", student_exercise_list_exercise_path(@exercise), :class => "fr font-12 color-grey mr15 mt5" %> + <%= link_to "设置", setting_exercise_path(@exercise), :class => "fr font-12 mr15 mt5 color-grey" %> +
    + + <%= render :partial => "exercise/edu_edit_form", :locals => {:is_edit => true} %> +
    + diff --git a/app/views/exercise/index.html.erb b/app/views/exercise/index.html.erb index 6baa14d2e..5816d35d8 100644 --- a/app/views/exercise/index.html.erb +++ b/app/views/exercise/index.html.erb @@ -1,8 +1,12 @@ <%= stylesheet_link_tag 'polls', :media => 'all' %> -
    -
    - <%= render :partial => 'exercises_list'%> -
    + +
    +
    +
    +

    试卷列表

    + <% if @is_teacher %> + + 新建 + + + <% end %> +
    +
    +
    + <%= render :partial => "exercise/exercise_index_tab" %> +
    +
    + <%= render :partial => "exercise/exercises_list" %> +
    +
    +
    \ No newline at end of file diff --git a/app/views/exercise/index.js.erb b/app/views/exercise/index.js.erb new file mode 100644 index 000000000..a64ce1d4a --- /dev/null +++ b/app/views/exercise/index.js.erb @@ -0,0 +1,4 @@ +<% unless params[:page] %> + $("#exercise_index_tab").html("<%= j(render :partial => 'exercise/exercise_index_tab') %>"); +<% end %> +$("#exercise_index_list").html("<%= j(render :partial => 'exercise/exercises_list') %>"); \ No newline at end of file diff --git a/app/views/exercise/new.html.erb b/app/views/exercise/new.html.erb index 3d983d64f..ec179510e 100644 --- a/app/views/exercise/new.html.erb +++ b/app/views/exercise/new.html.erb @@ -1 +1,13 @@ -<%= render :partial => 'exercise_form'%> +<%#= render :partial => 'exercise_form'%> +
    +

    + + <%= link_to @course.name, course_path(@course) %> > <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> > 新建 +

    +
    +

    新建试卷

    + <%= link_to "返回", exercise_index_path(:course_id => @course.id), :class => "fr font-12 color-grey mr15 mt5" %> +
    + + <%= render :partial => "exercise/edu_edit_form", :locals =>{:is_edit => false} %> +
    diff --git a/app/views/exercise/set_public.js.erb b/app/views/exercise/set_public.js.erb new file mode 100644 index 000000000..6881ffb9f --- /dev/null +++ b/app/views/exercise/set_public.js.erb @@ -0,0 +1,2 @@ +$("#set_exercise_public_<%= @exercise.id %>").remove(); +$("#exercise_public_icon_<%= @exercise.id %>").remove(); \ No newline at end of file diff --git a/app/views/exercise/setting.html.erb b/app/views/exercise/setting.html.erb new file mode 100644 index 000000000..5e6272494 --- /dev/null +++ b/app/views/exercise/setting.html.erb @@ -0,0 +1,378 @@ + +
    +

    + + <%= link_to @course.name, course_path(@course) %> > <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> > #<%= get_ex_index(@exercise, @course, @is_teacher) + 1 %> +

    +
    +

    + + <%= @exercise.exercise_name %> +

    + <%= link_to "返回", student_exercise_list_exercise_path(@exercise), :class => "fr font-12 mr15 mt3 color-grey" %> +
    + +
    +<% edit_mode = @is_new && @is_teacher %> +
    + +
    +
    +
    +
    +

    发布设置

    + <% if @is_teacher %> + 编辑 + <% end %> +
    +
    +
    +
      +
    • + + + +
    • +
    • + + +
      +
    • + + + + + + + + + +
    +
    +
    +
    + +
    +
    +

    答题设置

    +
    +
    +
    +
      + + + + + + + + + + + + +
    • + + > + + (选中则学生答题时,题目顺序按照题型随机显示) +
      + > + + (选中则学生答题时,选项顺序随机显示) +
    • +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + +
    +
    +

    公开设置

    +
    +
    +
    +
      +
    • + + > + + (选中则在截止时间之后对班级学生公开所有成员的成绩,否则不公开) +
    • +
    • + + > + + (选中则在截止时间之后对班级学生公开试卷题目的答案,否则不公开) +
    • +
    +
    +
    +
    +
    + + +
    + <%= form_tag(ex_setting_exercise_path(@exercise), :method => "post", :id => 'exercise_setting_form') do |f| %> +
    +
    +

    发布设置

    +
    +
    +
    +
      +
    • + + 1 ? 'disabled' : '' %> class="fl task-form-15 task-height-40 panel-box-sizing <%= @exercise.try(:exercise_status) > 1 ? 'disabled-bg' : '' %>" placeholder="请选择发布时间"> + + +
    • +
    • + + class="fl task-form-15 task-height-40 panel-box-sizing <%= @exercise.try(:exercise_status) == 3 ? 'disabled-bg' : '' %>" placeholder="请选择截止时间"> + + + + 不能早于发布时间 +
    • + + + + + + + + + + +
    +
    +
    +
    + +
    +
    +

    答题设置

    +
    +
    +
    +
      + + + + + + + + + + + + +
    • + + class="magic-checkbox fl mt5 magic-checkbox_show" id="dt_3" type="checkbox" <%= @exercise.question_random == 1 ? 'checked' : '' %>> + + (选中则学生答题时,题目顺序按照题型随机显示) +
      + class="magic-checkbox fl mt5 magic-checkbox_show" id="dt_4" type="checkbox" <%= @exercise.choice_random == 1 ? 'checked' : '' %>> + + (选中则学生答题时,选项顺序随机显示) +
    • +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + +
    +
    +

    公开设置

    +
    +
    +
    +
      +
    • + + > + + (选中则在截止时间之后对班级学生公开所有成员的成绩,否则不公开) +
    • +
    • + + > + + (选中则在截止时间之后对班级学生公开试卷题目的答案,否则不公开) +
    • +
    +
    +
    +
    + <% end %> +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + 保存 + 取消 +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/exercise/show.html.erb b/app/views/exercise/show.html.erb index c488ec203..71011cf9d 100644 --- a/app/views/exercise/show.html.erb +++ b/app/views/exercise/show.html.erb @@ -1,10 +1,10 @@ <%= stylesheet_link_tag 'polls', :media => 'all' %> <% if @is_teacher %> - <%= render :partial => 'exercise_teacher', :locals =>{:exercise =>@exercise, :exercise_questions => @exercise_questions} %> + <%= render :partial => 'exercise_teacher' %> <% else %> - <% if @can_edit_excercise %> - <%=render :partial => 'exercise_student', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user} %> - <% else %> - <%=render :partial => 'exercise_student_result', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user,:user=>User.current} %> - <% end %> + <%# if @can_edit_excercise %> + <%=render :partial => 'exercise_student' %> + <%# else %> + <%#=render :partial => 'exercise_student_result', :locals => {:user=>User.current} %> + <%# end %> <% end %> \ No newline at end of file diff --git a/app/views/exercise/student_exercise_list.html.erb b/app/views/exercise/student_exercise_list.html.erb index 10ba57ff3..cc9304f7a 100644 --- a/app/views/exercise/student_exercise_list.html.erb +++ b/app/views/exercise/student_exercise_list.html.erb @@ -1,126 +1,117 @@ - -
    -
    -
    - - - <% if @is_teacher%> -
    - <%= link_to "导出成绩", student_exercise_list_exercise_path(@exercise.id,:course_id => @course.id, :format => 'xls'),:class=>'linkBlue', :id => "export_student_work"%> -
    - <% end%> -
    -
    - -
    -
    - <%= link_to @exercise.exercise_name, exercise_path(@exercise), :class => 'homepagePostTitle fl hidden m_w460', :title => "#{@exercise.exercise_name}", :target => '_blank' %> - <% if @exercise.exercise_status == 1 %> - 未发布 - <% elsif @exercise.exercise_status == 2 %> - 已发布 - <% elsif @exercise.exercise_status == 3 %> - 已截止 - <% end%> - [ 隐藏测验信息 ] -
    -
    发布者:<%= @exercise.user.show_name %>
    -
    -
    <%= @exercise.exercise_description.html_safe %>
    -
    - - -
    -
    -
    截止时间:<%= format_time @exercise.end_time %>
    - <% if @exercise.exercise_status == 1 %> -
    发布时间:<%= format_time @exercise.publish_time %>
    - <% end %> - <% if @exercise.end_time && @exercise.end_time.to_time.to_i > Time.now.to_i %> - <% end_time = @exercise.end_time.to_time.to_i %> -
    提交剩余时间: <%= (end_time - Time.now.to_i) / (24*60*60) %> 天 - <%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%> 小时 - <%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%>
    - <% else %> -
    提交已截止
    +
    +

    + + <%= link_to @course.name, course_path(@course) %> > <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> > #<%= get_ex_index(@exercise, @course, @is_teacher) + 1 %> +

    +
    +

    + <% unless @exercise.is_public %> + <% end %> + <%= @exercise.exercise_name %> +

    + <%= link_to "返回", exercise_index_path(:course_id => @course.id), :class => "fr font-12 mr15 mt3 color-grey" %> + <% if @is_teacher %> + <%= link_to "设置", setting_exercise_path(@exercise), :class => "fr font-12 mr15 mt3 color-grey" %> + <% else %> + + <%= link_to "查看设置", setting_exercise_path(@exercise), :class => "fr font-12 mr15 mt3 color-grey" %> + <% end %> +
    +
    + +
    + + <% if @is_teacher %> +
    +
  • + <%= link_to "导出成绩", student_exercise_list_exercise_path(@exercise, :course_id => @course.id, :format => 'xls'), :id => "export_exercise_work", :class => "fr white-btn orange-btn ml10 mt8" %> +
    +
    + + +
    + +
    +
  • + +
  • + 你的评阅: + + 不限 + + > + + > + +
  • +
  • + 作品状态: + + 不限 + + > + + > + +
  • +
  • + 分班情况: + + 不限 + + <% @exercise.course.course_groups.each do |group| %> + > + <% end %> -
    -
  • -
    -
    + + + + + <% elsif User.current.member_of_course?(@exercise.course) %> + +

    + <% ex_user = @exercise.exercise_users.where(:user_id => User.current).first %> + <% if ex_user %> + <% if ex_user.commit_status > 0 %> + 你已提交 + <%= link_to '查看答题', ex_user.commit_status == 1 ? exercise_path(@exercise,:user_id => User.current.id) : show_student_result_exercise_path(@exercise,:user_id => User.current.id), :class => "white-btn orange-btn fr" %> + <% else %> + 你未提交 + <% if @exercise.exercise_status == 2 %> + <%= link_to (ex_user.start_at.nil? ? "开始答题" : "继续答题"), exercise_path(@exercise,:user_id => User.current.id), :class => "white-btn orange-btn fr" %> + <% end %> + <% end %> + <% end %> +

    +

    + (<%= @has_commit_count %>人已交) + <% if @exercise.exercise_status == 2 && @exercise.end_time > Time.now %> + <% end_time = @exercise.end_time.to_time.to_i %> + 答题剩余时间:<%= (end_time - Time.now.to_i) / (24*60*60) %><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%>小时<%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%> + <% elsif @exercise.exercise_status == 3 %> + 提交已截止 + <% end %> +

    + <% end %> -
    -
    -
    - <%= render :partial => "exercise/student_exercise"%> -
    -
    +
    + <%= render :partial => "exercise/student_exercise"%>
    - -
    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/app/views/exercise/student_exercise_list.js.erb b/app/views/exercise/student_exercise_list.js.erb index dd9aa50c3..fe0a29278 100644 --- a/app/views/exercise/student_exercise_list.js.erb +++ b/app/views/exercise/student_exercise_list.js.erb @@ -1,2 +1,2 @@ $("#exercise_student_work_list").html("<%= escape_javascript(render :partial => 'exercise/student_exercise') %>"); -$("#export_student_work").replaceWith("<%= escape_javascript( link_to "导出成绩", student_exercise_list_exercise_path(@exercise.id,:course_id => @course.id, :group => @select_group, :name => @name, :format => 'xls'),:class=>'linkBlue', :id => 'export_student_work') %>"); \ No newline at end of file +$("#export_exercise_work").replaceWith("<%= escape_javascript(link_to "导出成绩", student_exercise_list_exercise_path(@exercise, :course_id => @course.id, :format => 'xls'), :class => "fr white-btn orange-btn ml10 mt8", :id => "export_exercise_work") %>"); \ No newline at end of file diff --git a/app/views/exercise/update.js.erb b/app/views/exercise/update.js.erb index 9724b2bd1..edfb7a7e6 100644 --- a/app/views/exercise/update.js.erb +++ b/app/views/exercise/update.js.erb @@ -1,5 +1,4 @@ -$("#polls_head_show").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:exercise => @exercise}) %>"); -$("#polls_head_edit").html("<%= escape_javascript(render :partial => 'edit_head', :locals => {:exercise => @exercise}) %>"); -$("#polls_head_edit").hide(); -$("#polls_head_show").show(); -$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>"); \ No newline at end of file +$("#exercise_head_show").html("<%= escape_javascript(render :partial => 'show_head') %>"); +$("#exercise_head_edit").html("<%= escape_javascript(render :partial => 'edit_head') %>"); +$("#exercise_head_edit").hide(); +$("#exercise_head_show").show(); \ No newline at end of file diff --git a/app/views/exercise/update_exercise_question.js.erb b/app/views/exercise/update_exercise_question.js.erb index 89dfb27b6..624df0dc5 100644 --- a/app/views/exercise/update_exercise_question.js.erb +++ b/app/views/exercise/update_exercise_question.js.erb @@ -20,6 +20,4 @@ $("#poll_questions_<%= @exercise_question.id%>").html("
    {:exercise_question => @exercise_question}) %>" + "<% end%>" + "
    "); -<% current_score = get_current_score @exercise %> -$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score', :locals => {:exercise => @exercise, :current_score => current_score}) %>"); -$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise_question.exercise}) %>"); +$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score') %>"); \ No newline at end of file diff --git a/app/views/exercise/update_question_num.js.erb b/app/views/exercise/update_question_num.js.erb index 4a3bef3f9..d1284e659 100644 --- a/app/views/exercise/update_question_num.js.erb +++ b/app/views/exercise/update_question_num.js.erb @@ -7,7 +7,7 @@ <% elsif @before_que.question_type == 3%> $("#show_poll_questions_<%= @before_que.id %>").html("<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @before_que}) %>"); <% elsif @before_que.question_type == 4%> - $("#show_poll_questions_<%= @before_que.id %>").html("<%= escape_javascript(render :partial => 'show_mulit', :locals => {:exercise_question => @before_que}) %>"); + $("#show_poll_questions_<%= @before_que.id %>").html("<%= escape_javascript(render :partial => 'show_multi', :locals => {:exercise_question => @before_que}) %>"); <% end%> <% elsif @after_que %> $("#poll_questions_<%= @exercise_question.id%>").insertAfter($("#poll_questions_<%= @after_que.id%>")); @@ -18,7 +18,7 @@ <% elsif @after_que.question_type == 3%> $("#show_poll_questions_<%= @after_que.id %>").html("<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @after_que}) %>"); <% elsif @after_que.question_type == 4%> - $("#show_poll_questions_<%= @after_que.id %>").html("<%= escape_javascript(render :partial => 'show_mulit', :locals => {:exercise_question => @after_que}) %>"); + $("#show_poll_questions_<%= @after_que.id %>").html("<%= escape_javascript(render :partial => 'show_multi', :locals => {:exercise_question => @after_que}) %>"); <% end%> <% end %> <% if @exercise_question.question_type == 1%> @@ -28,5 +28,5 @@ <% elsif @exercise_question.question_type == 3%> $("#show_poll_questions_<%= @exercise_question.id %>").html("<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_question}) %>"); <% elsif @exercise_question.question_type == 4%> - $("#show_poll_questions_<%= @exercise_question.id %>").html("<%= escape_javascript(render :partial => 'show_mulit', :locals => {:exercise_question => @exercise_question}) %>"); + $("#show_poll_questions_<%= @exercise_question.id %>").html("<%= escape_javascript(render :partial => 'show_multi', :locals => {:exercise_question => @exercise_question}) %>"); <% end%> \ No newline at end of file diff --git a/app/views/homework_common/_new_common_homework.html.erb b/app/views/homework_common/_new_common_homework.html.erb index a5c0d6c77..8ba926895 100644 --- a/app/views/homework_common/_new_common_homework.html.erb +++ b/app/views/homework_common/_new_common_homework.html.erb @@ -22,6 +22,7 @@ <%= f.kindeditor :description, :editor_id => 'homework_description_editor', :owner_id => @homework.nil? ? 0: @homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON, + :placeholder => "请在此输入您的作业描述", :width => '90%', :height => 200, :minHeight=>200, diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 87d35593c..6d3e385f0 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -116,6 +116,12 @@ <%= count %> <%#= link_to( "+", new_board_message_path(:board_id => course_board.id), :class => 'fr mr15 font-18 link-color-grey', :title => "#{l(:label_message_new)}") if User.current.logged? %> + <% count = User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count %> +
  • + 试卷 + <%= count %> + <%#= link_to( "+", new_exercise_path(:course_id => @course.id), :class => 'fr mr15 font-18 link-color-grey', :title =>"新建试卷") if is_teacher %> +
  • <%= render :partial => 'layouts/group_children_list', :locals => {:is_teacher => is_teacher} %>
    diff --git a/app/views/layouts/base_edu.html.erb b/app/views/layouts/base_edu.html.erb index fa4982b2b..ef5b5a61c 100644 --- a/app/views/layouts/base_edu.html.erb +++ b/app/views/layouts/base_edu.html.erb @@ -48,6 +48,9 @@ + diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 43e0cd963..e2a125e0b 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -33,15 +33,14 @@ <% if User.current.logged? %>

    - <% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) || User.current == @topic.author %> - + + <% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) %> + <% end %> <% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) || User.current == @topic.author %> - <% end %> - <% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) %> - + <% end %>

    <% end %> diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index 771f5b1a0..e06a1754c 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -28,7 +28,7 @@ <%= my_score.nil? ? "--" : format("%.1f",my_score.score)%> - <%= link_to @homework.homework_detail_manual.comment_status == 3 ? '评阅' : '查看', student_work_path(student_work), :class => 'link-color-blue' %> + <%= link_to @homework.homework_detail_manual.comment_status == 3 ? '评阅' : '查看', student_work_path(student_work), :class => 'link-color-blue', :target => "_blank" %> <% end%> diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 4eecb92e1..4293c48ec 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -226,7 +226,7 @@ <% end %>
    - + ×
    diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index 05111532b..a8c9fc348 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -1,6 +1,6 @@ <% content_for :header_tags do %> - <%= import_ke(enable_at: true, prettify: false, init_activity: false) %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> <% end %>