Merge branch 'dev_local' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_local

dev_local
huang 6 years ago
commit 04f3349063

@ -326,14 +326,16 @@ class BoardsController < ApplicationController
end
def update_position
if @course || @contest
if @course
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
boards = @board.parent.children
if params[:opr] == 'up' && @board.position > 1
if @is_teacher && params[:opr] == 'up' && @board.position > 1
before_board = boards.where("position = #{@board.position - 1}").first
if before_board && @board.update_attribute('position', @board.position - 1)
before_board.update_attribute('position', before_board.position + 1)
end
elsif params[:opr] == 'down' && @board.position < boards.count
elsif @is_teacher && params[:opr] == 'down' && @board.position < boards.count
after_board = boards.where("position = #{@board.position + 1}").first
if after_board && @board.update_attribute('position', @board.position + 1)
after_board.update_attribute('position', after_board.position - 1)

@ -73,8 +73,14 @@ class ExerciseController < ApplicationController
@exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first
if @exercise_user.nil?
@exercise_user = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false, :commit_status => 0)
if @exercise.exercise_level_settings.where("num != exercise_questions_count").count > 0
@exercise.create_user_question_list(@exercise_user)
end
# @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first
elsif @exercise_user.start_at.nil?
if @exercise.exercise_level_settings.where("num != exercise_questions_count").count > 0
@exercise.create_user_question_list(@exercise_user)
end
@exercise_user.update_attributes(:start_at => Time.now)
end
@ -103,7 +109,9 @@ class ExerciseController < ApplicationController
@exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", params[:user_id], @exercise.id).first
@can_edit_excercise = false
end
Rails.logger.info("###########can_edit_excercise:#{@can_edit_excercise}")
@exercise_questions = user_question_list @exercise_user.id
# @percent = get_percent(@exercise,User.current)
#@exercise_questions = @exercise.exercise_questions
respond_to do |format|
@ -139,11 +147,16 @@ class ExerciseController < ApplicationController
else
none_shixun_ids = ShixunSchool.where("school_id != #{User.current.user_extensions.try(:school_id)}").pluck(:shixun_id)
end
@shixuns = Shixun.where("status = 2 and id not in (#{none_shixun_ids.join(",")})").where("name like ?", "%#{search}%").select{|shixun| shixun.challenges.where(:st => 1).count == 0}
@limit = 8
@shixuns = Shixun.where("status = 2 and challenges_count = 1 and id not in (#{none_shixun_ids.join(",")})").
where("name like ?", "%#{search}%").select{|shixun| shixun.challenges.where(:st => 1).count == 0}
@limit = 10
@total_pages = (@shixuns.count / 10.0).ceil
@shixuns = paginateHelper @shixuns, @limit
respond_to do |format|
format.js
format.json {
render json: exercise_shixun_json_data(@shixuns)
}
end
end
@ -977,118 +990,122 @@ class ExerciseController < ApplicationController
# 已提交过的且是限时的则不允许答题
exercise_user = ExerciseUser.where(:exercise_id => @exercise.id, :user_id => User.current.id).first
if (exercise_user && exercise_user.commit_status == 1) || @exercise.end_time < Time.now
render :json => {:text => "Over"}
return
end
if eq.question_type == 1
# 单选题
ea = ExerciseAnswer.find_by_exercise_question_id_and_user_id(params[:exercise_question_id],User.current.id)
if ea.nil?
# 尚未答该题,添加答案
ea = ExerciseAnswer.new
ea.user_id = User.current.id
ea.exercise_question_id = params[:exercise_question_id]
end
#修改该题对应答案
ea.exercise_choice_id = params[:exercise_choice_id]
if ea.save
# 保存成功返回成功信息及当前以答题百分比
uncomplete_question = get_uncomplete_question(@exercise, User.current)
if uncomplete_question.count < 1
complete = 1;
else
complete = 0;
end
@percent = get_percent(@exercise,User.current)
render :json => {:text => "ok" ,:complete => complete,:percent => format("%.2f" ,@percent)}
else
#返回失败信息
render :json => {:text => "failure"}
if exercise_user
if (exercise_user && exercise_user.commit_status == 1) || @exercise.end_time < Time.now
render :json => {:text => "Over"}
return
end
elsif eq.question_type == 2
#多选题
ea = ExerciseAnswer.find_by_exercise_choice_id_and_user_id(params[:exercise_choice_id],User.current.id)
if ea.nil?
#尚未答该题,添加答案
ea = ExerciseAnswer.new
ea.user_id = User.current.id
ea.exercise_question_id = params[:exercise_question_id]
if eq.question_type == 1
# 单选题
ea = ExerciseAnswer.find_by_exercise_question_id_and_user_id(params[:exercise_question_id],User.current.id)
if ea.nil?
# 尚未答该题,添加答案
ea = ExerciseAnswer.new
ea.user_id = User.current.id
ea.exercise_question_id = params[:exercise_question_id]
end
#修改该题对应答案
ea.exercise_choice_id = params[:exercise_choice_id]
if ea.save
uncomplete_question = get_uncomplete_question(@exercise, User.current)
# 保存成功返回成功信息及当前以答题百分比
uncomplete_question = get_uncomplete_question(@exercise, exercise_user)
if uncomplete_question.count < 1
complete = 1;
else
complete = 0;
end
is_answer = User.current.exercise_answer.where(:exercise_question_id => params[:exercise_question_id].to_i).count > 0
@percent = get_percent(@exercise,User.current)
render :json => {:text => "ok",:complete => complete,:percent => format("%.2f" ,@percent),:is_answer => is_answer}
else
render :json => {:text => "failure"}
end
else
#pv不为空则当前选项之前已被选择再次点击则是不再选择该项故删除该答案
if ea.delete
is_answer = User.current.exercise_answer.where(:exercise_question_id => params[:exercise_question_id].to_i).count > 0
@percent = get_percent(@exercise, User.current)
render :json => {:text => "false" ,:percent => format("%.2f" , @percent),:is_answer => is_answer}
@percent = get_percent(@exercise, exercise_user)
render :json => {:text => "ok" ,:complete => complete,:percent => format("%.2f" ,@percent)}
else
#返回失败信息
render :json => {:text => "failure"}
end
end
elsif eq.question_type == 3 || eq.question_type == 4
#单行文本,多行文本题
ea = ExerciseAnswer.find_by_exercise_question_id_and_user_id(params[:exercise_question_id], User.current.id)
if ea.nil?
# ea为空之前尚未答题添加答案
if params[:answer_text].nil? || params[:answer_text].blank?
#用户提交空答案,视作不作答
@percent = get_percent(@exercise,User.current)
render :json => {:text => "",:percent => format("%.2f", @percent)}
else
#添加答案
elsif eq.question_type == 2
#多选题
ea = ExerciseAnswer.find_by_exercise_choice_id_and_user_id(params[:exercise_choice_id],User.current.id)
if ea.nil?
#尚未答该题,添加答案
ea = ExerciseAnswer.new
ea.user_id = User.current.id
ea.exercise_question_id = params[:exercise_question_id]
ea.answer_text = params[:answer_text]
ea.exercise_choice_id = params[:exercise_choice_id]
if ea.save
uncomplete_question = get_uncomplete_question(@exercise, User.current)
uncomplete_question = get_uncomplete_question(@exercise, exercise_user)
if uncomplete_question.count < 1
complete = 1;
else
complete = 0;
end
@percent = get_percent(@exercise,User.current)
render :json => {:text => ea.answer_text,:complete => complete,:percent => format("%.2f",@percent)}
is_answer = User.current.exercise_answer.where(:exercise_question_id => params[:exercise_question_id].to_i).count > 0
@percent = get_percent(@exercise, exercise_user)
render :json => {:text => "ok",:complete => complete,:percent => format("%.2f" ,@percent),:is_answer => is_answer}
else
render :json => {:text => "failure"}
end
end
else
# ea不为空说明用户之前已作答
if params[:answer_text].nil? || params[:answer_text].blank?
# 用户提交空答案,视为删除答案
else
#pv不为空则当前选项之前已被选择再次点击则是不再选择该项故删除该答案
if ea.delete
@percent = get_percent(@exercise,User.current)
render :json => {:text => "",:percent => format("%.2f", @percent)}
is_answer = User.current.exercise_answer.where(:exercise_question_id => params[:exercise_question_id].to_i).count > 0
@percent = get_percent(@exercise, exercise_user)
render :json => {:text => "false" ,:percent => format("%.2f" , @percent),:is_answer => is_answer}
else
render :json => {:text => "failure"}
end
end
elsif eq.question_type == 3 || eq.question_type == 4
#单行文本,多行文本题
ea = ExerciseAnswer.find_by_exercise_question_id_and_user_id(params[:exercise_question_id], User.current.id)
if ea.nil?
# ea为空之前尚未答题添加答案
if params[:answer_text].nil? || params[:answer_text].blank?
#用户提交空答案,视作不作答
@percent = get_percent(@exercise, exercise_user)
render :json => {:text => "",:percent => format("%.2f", @percent)}
else
#添加答案
ea = ExerciseAnswer.new
ea.user_id = User.current.id
ea.exercise_question_id = params[:exercise_question_id]
ea.answer_text = params[:answer_text]
if ea.save
uncomplete_question = get_uncomplete_question(@exercise, exercise_user)
if uncomplete_question.count < 1
complete = 1;
else
complete = 0;
end
@percent = get_percent(@exercise, exercise_user)
render :json => {:text => ea.answer_text,:complete => complete,:percent => format("%.2f",@percent)}
else
render :json => {:text => "failure"}
end
end
else
#用户修改答案
ea.answer_text = params[:answer_text]
if ea.save
@percent = get_percent(@exercise,User.current)
render :json => {:text => ea.answer_text,:percent => format("%.2f", @percent)}
# ea不为空说明用户之前已作答
if params[:answer_text].nil? || params[:answer_text].blank?
# 用户提交空答案,视为删除答案
if ea.delete
@percent = get_percent(@exercise, exercise_user)
render :json => {:text => "",:percent => format("%.2f", @percent)}
else
render :json => {:text => "failure"}
end
else
render :json => {:text => "failure"}
#用户修改答案
ea.answer_text = params[:answer_text]
if ea.save
@percent = get_percent(@exercise, exercise_user)
render :json => {:text => ea.answer_text,:percent => format("%.2f", @percent)}
else
render :json => {:text => "failure"}
end
end
end
end
else
render :json => {:text => "failure"}
end
else
render :json => {:text => "failure"}
end
@ -1165,9 +1182,10 @@ class ExerciseController < ApplicationController
# 获取学生未答情况
def get_student_uncomplete_question
exercise_user = @exercise.exercise_users.where(:user_id => User.current).first
time_limit = @exercise.time == -1 || @exercise.time.nil?
uncomplete_count = get_uncomplete_question(@exercise, User.current).count
uncomplete_shixun = get_uncomplete_shixun(@exercise, User.current).count
uncomplete_count = get_uncomplete_question(@exercise, exercise_user).count
uncomplete_shixun = get_uncomplete_shixun(@exercise, exercise_user).count
render :json => {:time_limit => time_limit, :uncomplete_count => uncomplete_count, :uncomplete_shixun => uncomplete_shixun}
end
@ -1241,8 +1259,8 @@ class ExerciseController < ApplicationController
@is_teacher = params[:pdf] ? true : 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]
@exercise_questions = @exercise.exercise_questions
@exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first
@exercise_questions = @exercise.user_question_list @exercise_user.id
respond_to do |format|
if params[:pdf]
format.html { render :layout => "pdf" }
@ -1305,7 +1323,8 @@ class ExerciseController < ApplicationController
score2 = 0
score3 = 0
score4 = 0
exercise_qustions = exercise.exercise_questions
exercise_user = exercise.exercise_users.where(user_id: user.id).first
exercise_qustions = exercise.user_question_list(exercise_user.try(:id))
exercise_qustions.each do |question|
if question.question_type != 5
answer = get_user_answer(question, user)
@ -1608,11 +1627,11 @@ class ExerciseController < ApplicationController
standard_answer
end
# 是否完成了答题
def get_complete_question(exercise,user)
questions = exercise.exercise_questions.includes(:exercise_answers)
def get_complete_question(exercise, exercise_user)
questions = exercise.user_question_list(exercise_user.id).includes(:exercise_answers)
complete_question = []
questions.each do |question|
answers = question.exercise_answers.select{|e| e.user_id == user.id}
answers = question.exercise_answers.select{|e| e.user_id == exercise_user.user_id}
if !(answers.nil? || answers.count < 1)
complete_question << question
end
@ -1621,12 +1640,13 @@ class ExerciseController < ApplicationController
end
# 获取答题百分比
def get_percent exercise,user
complete_count = get_complete_question(exercise,user).count
if exercise.exercise_questions.count == 0
def get_percent exercise, exercise_user
complete_count = get_complete_question(exercise,exercise_user).count
questions = exercise.user_question_list(exercise_user.id)
if questions.count == 0
return 0
else
return (complete_count.to_f / exercise.exercise_questions.count.to_f)*100
return (complete_count.to_f / questions.count.to_f)*100
end
end

@ -106,7 +106,7 @@ class GraduationTopicsController < ApplicationController
def student_select_topic
if User.current.student_graduation_topics.where(:course_id => @course.id, :status => [0, 1]).count == 0
@topic.student_graduation_topics << StudentGraduationTopic.new(:course_id => @course.id, :user_id => User.current.id,
:member_id => @course.members.where(:user_id => User.current.id).first.try(:id))
:member_id => @course.course_members.where(:user_id => current_user.id).first.try(:id))
@topic.update_attributes(:status => 1)
end
redirect_to graduation_topic_path(@topic)

@ -359,8 +359,8 @@ class HomeworkCommonController < ApplicationController
# homework 的记录更新
# 发布时间不为空
if params_publish_time && min_publish_time != ""
@homework.publish_time = min_publish_time
@homework.end_time = max_end_time
@homework.publish_time = min_publish_time if @homework.publish_time.nil? || @homework.publish_time > Time.now
@homework.end_time = max_end_time if @homework.end_time.nil? || @homework.end_time > Time.now
# @homework.archive_time = params_archive_time if params_archive_time
if @homework.publish_time < Time.now and @homework_detail_manual.comment_status == 0
@homework_detail_manual.comment_status = 1
@ -379,10 +379,10 @@ class HomeworkCommonController < ApplicationController
=end
# 发布时间未设置 则按当前时间立即发布
elsif params_publish_time && min_publish_time == ""
@homework_detail_manual.comment_status = 1
@homework.publish_time = Time.now
@homework_detail_manual.comment_status = 1 if @homework_detail_manual.comment_status == 0
@homework.publish_time = Time.now if @homework.publish_time.nil? || @homework.publish_time > Time.now
@homework.unified_setting = 1
@homework.end_time = Time.at(((1.month.since.to_i)/3600.0).ceil * 3600)
@homework.end_time = Time.at(((1.month.since.to_i)/3600.0).ceil * 3600) if @homework.end_time.nil? || @homework.end_time > Time.now
# @homework.archive_time = Time.at(((2.months.since.to_i)/3600.0).ceil * 3600)
create_homework_user = 1
@ -391,7 +391,7 @@ class HomeworkCommonController < ApplicationController
end
# 已发布的作业,只更新截止时间和结束时间
else
@homework.end_time = max_end_time if params_end_time
@homework.end_time = max_end_time if params_end_time && (@homework.end_time.nil? || @homework.end_time > Time.now)
# @homework.archive_time = params_archive_time if params_archive_time
=begin

@ -1,5 +1,20 @@
# encoding: utf-8
module ExerciseHelper
def exercise_shixun_json_data shixuns
shixuns.map do |shixun|
shixun_owner = shixun.owner.try(:show_name)
shixun_path = shixun_path(shixun)
shixun_level = shixun.shixun_level
owner_path = user_path(shixun.owner)
shixun.attributes.dup.except("gpid", "identifier", "major_id", "webssh", "homepage_show", "fork_from", "git_url",
"mirror_script_id", "repo_name", "pod_life").merge({
shixun_owner: shixun_owner,
shixun_level: shixun_level,
shixun_path: shixun_path,
owner_path: owner_path
})
end
end
def un_commit_num exercise
course = exercise.course
@ -266,12 +281,13 @@ module ExerciseHelper
end
#获取未完成的题目
def get_uncomplete_question exercise,user
def get_uncomplete_question exercise, exercise_user
# all_questions = exercise.exercise_questions.includes(:exercise_answers).where("question_type != 5")
uncomplete_question = []
exercise.exercise_questions.includes(:exercise_answers).where("question_type != 5").each do |question|
questions = exercise.user_question_list(exercise_user.id)
questions.includes(:exercise_answers).where("question_type != 5").each do |question|
# answers = get_user_answer(question, user)
answers = question.exercise_answers.select{|e| e.user_id == user.id}
answers = question.exercise_answers.select{|e| e.user_id == exercise_user.user_id}
if answers.empty?
uncomplete_question << question
end
@ -280,8 +296,9 @@ module ExerciseHelper
end
# 获取未通关的实训
def get_uncomplete_shixun exercise,user
all_questions = exercise.exercise_questions.where("question_type = 5")
def get_uncomplete_shixun exercise, exercise_user
questions = exercise.user_question_list(exercise_user.try(:id))
all_questions = questions.where("question_type = 5")
uncomplete_shixun = []
all_questions.each do |question|
myshixun = Myshixun.where(:shixun_id => question.shixun_id, :user_id => user.id).first

@ -5,13 +5,17 @@ class Exercise < ActiveRecord::Base
belongs_to :course ,:touch => true
belongs_to :exercise_bank
has_many :exercise_group_settings, :dependent => :destroy
has_many :exercise_questions, :dependent => :destroy,:order => "#{ExerciseQuestion.table_name}.question_number"
has_many :exercise_questions, :dependent => :destroy
has_many :exercise_users, :dependent => :destroy, :conditions => "exercise_users.is_delete = 0"
has_many :users, :through => :exercise_users #该测试被哪些用户提交答案过
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
# 课程消息
has_many :tidings, as: :container, dependent: :destroy
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
has_many :exercise_level_settings, :dependent => :destroy
has_many :exercise_user_questions
after_create :acts_as_course_message
def acts_as_course_message
if self.course
@ -24,4 +28,27 @@ class Exercise < ActiveRecord::Base
end
end
end
def create_user_question_list exercise_user_id
self.exercise_questions.where("question_type != 5").each do |question|
self.exercise_user_questions << ExerciseUserQuestion.new(exercise_user_id: exercise_user_id,
exercise_question_id: question)
end
self.exercise_level_settings.each do |setting|
# 每个级别中随机挑选num个实训题
setting.exercise_questions.pluck(:id).sample(setting.num).each do |question_id|
self.exercise_user_questions << ExerciseUserQuestion.new(exercise_user_id: exercise_user_id,
exercise_question_id: question_id)
end
end
end
def user_question_list exercise_user_id
if self.exercise_user_questions.where(exercise_user_id: exercise_user_id).count == 0
self.exercise_questions
else
self.exercise_questions.where(id: self.exercise_user_questions.where(exercise_user_id: exercise_user_id).
pluck(:exercise_question_id))
end
end
end

@ -0,0 +1,5 @@
class ExerciseLevelSetting < ActiveRecord::Base
belongs_to :exercise
has_many :exercise_questions
# attr_accessible :level, :num, :score
end

@ -1,6 +1,7 @@
#encoding: utf-8
class ExerciseQuestion < ActiveRecord::Base
include Redmine::SafeAttributes
default_scope :order => 'question_number'
belongs_to :exercise
belongs_to :shixun
@ -11,6 +12,9 @@ class ExerciseQuestion < ActiveRecord::Base
has_many :exercise_answer_comments, :dependent => :destroy
has_many :exercise_standard_answers, :dependent => :destroy
belongs_to :exercise_level_setting, counter_cache: true
has_many :exercise_user_questions, :dependent => :destroy
def question_type_name
case self.question_type
when 1

@ -4,4 +4,6 @@ class ExerciseUser < ActiveRecord::Base
belongs_to :user
belongs_to :exercise
has_many :exercise_user_questions
end

@ -0,0 +1,6 @@
class ExerciseUserQuestion < ActiveRecord::Base
belongs_to :exercise
belongs_to :exercise_user
belongs_to :exercise_question
# attr_accessible :title, :body
end

@ -1,7 +1,8 @@
<% if @course %>
$("#tbc_04").html("<%=escape_javascript(render :partial => 'courses/settings/boards_setting') %>");
<% course_board = @course.boards.where(:parent_id => 0).first %>
$("#board_children_list").html("<%= escape_javascript(render :partial => 'layouts/board_children_list', :locals => {:course_board => course_board})%>");
$("#board_children_list").html("<%= escape_javascript(render :partial => 'layouts/board_children_list', :locals =>
{:course_board => course_board, :is_teacher => @is_teacher})%>");
<% elsif @contest %>
$("#game-setting-content-3").html("<%=escape_javascript(render :partial => 'contests/boards') %>");
<% contest_board = @contest.boards.where(:parent_id => 0).first %>

@ -32,7 +32,9 @@
<%= render :partial => 'users/course_create', :locals => {:activity => activity.course_act, :user_activity_id => activity.id, :is_course => 1} if activity.course_act %>
<% when 'JoinCourse' %>
<% act = CourseMessage.where(:id => activity.course_act_id).first %>
<%= render :partial => 'users/join_course', :locals => {:activity => act, :user_activity_id => activity.id} %>
<% if act.present? %>
<%= render :partial => 'users/join_course', :locals => {:activity => act, :user_activity_id => activity.id} %>
<% end %>
<% end %>
<% end %>
<% end %>

@ -1,35 +1,113 @@
<%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:html => {:id => "update_exercise_question_#{exercise_question.id}"}) do |f|%>
<div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 fillin_Temp" id="poll_answers_<%= exercise_question.id %>">
<p class="fl mt15 font-16 mb10">实训题</p>
<p class="clearfix mb10" style="margin-left: 78px;"><%= exercise_question.shixun.name %></p>
<li class="clearfix pr mb20">
<input name="question_type" value="5" type="hidden">
<label class="panel-form-label fl"><span class="mr10">要求</span></label>
<textarea maxlength="250" class="panel-form-width2-690 fl panel-box-sizing questionTitle undis" name="question_title" id="poll_questions_title_<%=exercise_question.id %>"><%=exercise_question.question_title.html_safe %></textarea>
</li>
<li class="clearfix pr mb10">
<label class="panel-form-label fl"><span class="mr10">序号</span></label>
<span class="fl with80 mt6 ml20 color-dark-grey" style="display: block;">关卡名称</span>
<span class="fl mt6 color-dark-grey" style="display: block;">分值</span>
</li>
<% exercise_question.exercise_shixun_challenges.each_with_index do |exercise_challenge,index| %>
<li class="clearfix pr mb10">
<label class="panel-form-label fl">
<span class="option-item fr ml6 color-grey select-choice" data-tip-left="第<%= index + 1 %>关"><%= index + 1 %></span>
</label>
<span class="fl ml20 mt6 with75 task-hide" style="display: block;"><%= exercise_challenge.challenge.subject %></span>
<input value="<%= exercise_challenge.question_score %>" type="text" class="with10 ml15 mr5 pl10 fl panel-box-sizing task-height-40" name="question_score[]" />
<label class="fl" style="line-height: 40px;">分</label>
</li>
<div class="cl"></div>
<% end %>
<li class="clearfix mb20">
<p class="fr">
<span class="font-12 color-grey mb10" style="display: block;">温馨提示:[实训题]属于客观题将由系统自动评分</span>
<a href="javascript:void(0)" class="fr task-btn task-btn-orange" onclick="edit_poll_question($(this),<%= exercise_question.id %>,5);">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr10" onclick="$('#edit_poll_questions_<%=exercise_question.id %>').hide();$('#show_poll_questions_<%=exercise_question.id %>').show();">取消</a>
</p>
</li>
</div>
<!-- <div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 fillin_Temp" id="poll_answers_<%#= exercise_question.id %>">-->
<!-- <p class="fl mt15 font-16 mb10">实训题</p>-->
<!-- <p class="clearfix mb10" style="margin-left: 78px;"><%#= exercise_question.shixun.name %></p>-->
<!-- <li class="clearfix pr mb20">-->
<!-- <input name="question_type" value="5" type="hidden">-->
<!-- <label class="panel-form-label fl"><span class="mr10">要求</span></label>-->
<!-- <textarea maxlength="250" class="panel-form-width2-690 fl panel-box-sizing questionTitle undis" name="question_title" id="poll_questions_title_<%#=exercise_question.id %>"><%#=exercise_question.question_title.html_safe %></textarea>-->
<!-- </li>-->
<!-- <li class="clearfix pr mb10">-->
<!-- <label class="panel-form-label fl"><span class="mr10">序号</span></label>-->
<!-- <span class="fl with80 mt6 ml20 color-dark-grey" style="display: block;">关卡名称</span>-->
<!-- <span class="fl mt6 color-dark-grey" style="display: block;">分值</span>-->
<!-- </li>-->
<%# exercise_question.exercise_shixun_challenges.each_with_index do |exercise_challenge,index| %>
<!-- <li class="clearfix pr mb10">-->
<!-- <label class="panel-form-label fl">-->
<!-- <span class="option-item fr ml6 color-grey select-choice" data-tip-left="第<%#= index + 1 %>关"><%#= index + 1 %></span>-->
<!-- </label>-->
<!-- <span class="fl ml20 mt6 with75 task-hide" style="display: block;"><%#= exercise_challenge.challenge.subject %></span>-->
<!-- <input value="<%#= exercise_challenge.question_score %>" type="text" class="with10 ml15 mr5 pl10 fl panel-box-sizing task-height-40" name="question_score[]" />-->
<!-- <label class="fl" style="line-height: 40px;">分</label>-->
<!-- </li>-->
<!-- <div class="cl"></div>-->
<%# end %>
<!-- <li class="clearfix mb20">-->
<!-- <p class="fr">-->
<!-- <span class="font-12 color-grey mb10" style="display: block;">温馨提示:[实训题]属于客观题将由系统自动评分</span>-->
<!-- <a href="javascript:void(0)" class="fr task-btn task-btn-orange" onclick="edit_poll_question($(this),<%#= exercise_question.id %>,5);">保存</a>-->
<!-- <a href="javascript:void(0)" class="fr task-btn mr10" onclick="$('#edit_poll_questions_<%=exercise_question.id %>').hide();$('#show_poll_questions_<%=exercise_question.id %>').show();">取消</a>-->
<!-- </p>-->
<!-- </li>-->
<!-- </div>-->
<% end %>
<div class="user_bg_shadow bor-grey-e mb20 answer_Temp edu-back-white practicalTemp" id="answer_Temp">
<div class="fl mt15 font-16 mb10 padding10 practicalTitlefont">实训题</div>
<div class="fl font-16 mb10 practicalTitle">
<span class="Titlefont">初级题</span>
<div class="fr mr40 shixun-title-font">
<span class="color-red mr5 shixun-title-font">*</span>分值:<input class="borderFF8121"/> 分/题
<div class="colorFF8121sum">*大于等于0且不能大于100</div>
<div class="colorFF8121sum">*不能为空</div>
<div class="colorFF8121sum">*必须大于等于0</div>
<div class="colorFF8121sum">*不能大于100</div>
</div>
<div class="fr mr40 shixun-title-font">
<span class="color-red mr5 shixun-title-font">*</span>
随机出题量:<input class="borderFF8121"/> 题
<div class="colorFF8121">*不能为空</div>
<div class="colorFF8121">*必须为正整数</div>
<div class="colorFF8121">*不能大于可用题数</div>
</div>
<div class="fr mr40 shixun-title-font">
<span class="color-orange mr5 shixun-title-font">3</span>
题可用
</div>
</div>
<div class="fl mb10 shixunsbox">
<div>
<a class="shixunsboxfont">命令加密ZPI压缩文件解压</a>
<span class="shixundelect">
<i data-tip-down="删除" class="fa fa-times-circle mr10 color-afafaf"></i>
</span>
</div>
<div>
<a class="shixunsboxfont">命令加密ZPI压缩文件解压</a>
<span class="shixundelect">
<i data-tip-down="删除" class="fa fa-times-circle mr10 color-afafaf"></i>
</span>
</div>
<div>
<a class="shixunsboxfont">命令加密ZPI压缩文件解压</a>
<span class="shixundelect">
<i data-tip-down="删除" class="fa fa-times-circle mr10 color-afafaf"></i>
</span>
</div>
</div>
<div class="fl mb10 shixunsboxs">
<div class="newshixunbox">
<div class="newshixunboxfont">新增实训题</div>
</div>
</div>
<li class="fl clearfix mb20 shixunsboxs">
<p class="mr40">
<a href="javascript:void(0)" class="fr task-btn task-btn-orange" id="add_new_question">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr30">取消</a>
<span class=" fr font-12 color-grey mt5 mr25" style="display: block;">
<span class="color-orange-tip ">温馨提示:</span>[实训题]属于客观题将由系统自动评分
</span>
</p>
</li>
</div>

@ -134,9 +134,9 @@
</div>
<% if @exercise.question_random == 1 %>
<% question_list = @exercise.exercise_questions.includes(:exercise_shixun_answers, :exercise_choices => [:exercise_answers]).shuffle %>
<% question_list = @exercise_questions.includes(:exercise_shixun_answers, :exercise_choices => [:exercise_answers]).shuffle %>
<% else %>
<% question_list = @exercise.exercise_questions.includes(:exercise_shixun_answers, :exercise_choices => [:exercise_answers]) %>
<% question_list = @exercise_questions.includes(:exercise_shixun_answers, :exercise_choices => [:exercise_answers]) %>
<% end %>

@ -76,7 +76,7 @@
</p>
</div>
<div class="clearfix ml80 mt10 mb5">
<% @exercise.exercise_questions.where(:question_type => [1, 2, 3, 5]).each do |eq| %>
<% exercise_questions.where(:question_type => [1, 2, 3, 5]).each do |eq| %>
<% is_correct = answer_is_correct(eq, user) %>
<a href="javascript:void(0);" onclick="scroll_70height(<%= eq.question_number%>);" style="cursor:pointer" class="checkstatus_box_big color_white <%= is_correct ? 'post_btn_green' : 'post_btn_red' %>"><%= eq.question_number %></a>
<% end %>
@ -88,14 +88,14 @@
<span class="mr15 mt3 fr color-grey font-14">开始答题时间:<%= format_time @exercise_user.start_at %></span>
</div>
<div class="clearfix ml80 mt10">
<% @exercise.exercise_questions.where(:question_type => 4).each do |eq| %>
<% exercise_questions.where(:question_type => 4).each do |eq| %>
<% ea = @exercise_user.user.exercise_answer.where(:exercise_question_id => eq.id).first %>
<a href="javascript:void(0);" onclick="scroll_70height(<%= eq.question_number%>);" style="cursor:pointer" id="ex_comment_status_<%= eq.id %>" class="checkstatus_box_big <%= (ea && ea.score == -1) ? 'post_btn_grey' : 'post_btn_white' %>"><%= eq.question_number %></a>
<% end %>
</div>
</div>
<div class="clearfix" id="problem_main">
<% question_list = @exercise.exercise_questions.includes(:exercise_shixun_answers, :exercise_choices => [:exercise_answers]) %>
<% question_list = exercise_questions.includes(:exercise_shixun_answers, :exercise_choices => [:exercise_answers]) %>
<% question_list.each do |exercise_question| %>
<div class="question_item_con font-14 user_bg_shadow bor-grey-e mb20 pt15">
<div class="clearfix pl15 pr15">

@ -3,40 +3,121 @@
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true, :id => "new_exercise_question"},
:url=>create_exercise_question_exercise_path(exercise.id)) do |f| %>
<div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 answer_Temp" id="answer_Temp">
<p class="fl mt15 font-16 mb10">实训题</p>
<input name="question_type" value="5" type="hidden">
<input name="shixun" value="<%= @shixun.id %>" type="hidden">
<input name="quest_id" id="quest_id" value="0" type="hidden">
<p class="clearfix mb10" style="margin-left: 78px;"><%= @shixun.name %></p>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="mr10">要求</span></label>
<textarea id="poll_questions_title" name="question_title" class="panel-form-width2-690 fl panel-box-sizing undis"></textarea>
</li>
<li class="clearfix pr mb10">
<label class="panel-form-label fl"><span class="mr10">序号</span></label>
<span class="fl with80 mt6 ml20 color-dark-grey" style="display: block;">关卡名称</span>
<span class="fl mt6 color-dark-grey" style="display: block;">分值</span>
</li>
<% @shixun.challenges.each_with_index do |challenge, i| %>
<li class="clearfix pr mb10">
<label class="panel-form-label fl">
<span class="option-item fr ml6 color-grey select-choice" data-tip-left="第<%= i + 1 %>关"><%= i + 1 %></span>
</label>
<span class="fl ml20 mt6 with75 task-hide" style="display: block;"><%= challenge.subject %></span>
<input value="" type="text" class="with10 ml15 mr5 pl10 fl panel-box-sizing task-height-40" name="question_score[]" />
<label class="fl" style="line-height: 40px;">分</label>
</li>
<% end %>
<li class="clearfix mb20">
<p class="fr">
<span class="font-12 color-grey mb10" style="display: block;">温馨提示:[实训题]属于客观题将由系统自动评分</span>
<a href="javascript:void(0)" class="fr task-btn task-btn-orange" id="add_new_question">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr10" onclick="$(this).parent().parent().parent().parent().parent().remove();">取消</a>
</p>
</li>
</div>
<!-- <div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 answer_Temp" id="answer_Temp">-->
<!-- <p class="fl mt15 font-16 mb10">实训题</p>-->
<!-- <input name="question_type" value="5" type="hidden">-->
<!-- <input name="shixun" value="<%#= @shixun.id %>" type="hidden">-->
<!-- <input name="quest_id" id="quest_id" value="0" type="hidden">-->
<!-- <p class="clearfix mb10" style="margin-left: 78px;"><%#= @shixun.name %></p>-->
<!-- <li class="clearfix pr mb20">-->
<!-- <label class="panel-form-label fl"><span class="mr10">要求</span></label>-->
<!-- <textarea id="poll_questions_title" name="question_title" class="panel-form-width2-690 fl panel-box-sizing undis"></textarea>-->
<!-- </li>-->
<!-- <li class="clearfix pr mb10">-->
<!-- <label class="panel-form-label fl"><span class="mr10">序号</span></label>-->
<!-- <span class="fl with80 mt6 ml20 color-dark-grey" style="display: block;">关卡名称</span>-->
<!-- <span class="fl mt6 color-dark-grey" style="display: block;">分值</span>-->
<!-- </li>-->
<%# @shixun.challenges.each_with_index do |challenge, i| %>
<!-- <li class="clearfix pr mb10">-->
<!-- <label class="panel-form-label fl">-->
<!-- <span class="option-item fr ml6 color-grey select-choice" data-tip-left="第<%#= i + 1 %>关"><%#= i + 1 %></span>-->
<!-- </label>-->
<!-- <span class="fl ml20 mt6 with75 task-hide" style="display: block;"><%#= challenge.subject %></span>-->
<!-- <input value="" type="text" class="with10 ml15 mr5 pl10 fl panel-box-sizing task-height-40" name="question_score[]" />-->
<!-- <label class="fl" style="line-height: 40px;">分</label>-->
<!-- </li>-->
<%# end %>
<!-- <li class="clearfix mb20">-->
<!-- <p class="fr">-->
<!-- <span class="font-12 color-grey mb10" style="display: block;">温馨提示:[实训题]属于客观题将由系统自动评分</span>-->
<!-- <a href="javascript:void(0)" class="fr task-btn task-btn-orange" id="add_new_question">保存</a>-->
<!-- <a href="javascript:void(0)" class="fr task-btn mr10" onclick="$(this).parent().parent().parent().parent().parent().remove();">取消</a>-->
<!-- </p>-->
<!-- </li>-->
<!-- </div>-->
<% end %>
<div class="user_bg_shadow bor-grey-e mb20 answer_Temp edu-back-white practicalTemp" id="answer_Temp">
<div class="fl mt15 font-16 mb10 padding10 practicalTitlefont">实训题</div>
<div class="fl font-16 mb10 practicalTitle">
<span class="Titlefont">初级题</span>
<div class="fr mr40 shixun-title-font">
<span class="color-red mr5 shixun-title-font">*</span>分值:<input class="borderFF8121"/> 分/题
<div class="colorFF8121sum">*大于等于0且不能大于100</div>
<div class="colorFF8121sum">*不能为空</div>
<div class="colorFF8121sum">*必须大于等于0</div>
<div class="colorFF8121sum">*不能大于100</div>
</div>
<div class="fr mr40 shixun-title-font">
<span class="color-red mr5 shixun-title-font">*</span>
随机出题量:<input class="borderFF8121"/> 题
<div class="colorFF8121">*不能为空</div>
<div class="colorFF8121">*必须为正整数</div>
<div class="colorFF8121">*不能大于可用题数</div>
</div>
<div class="fr mr40 shixun-title-font">
<span class="color-orange mr5 shixun-title-font">3</span>
题可用
</div>
</div>
<div class="fl mb10 shixunsbox">
<div>
<a class="shixunsboxfont">命令加密ZPI压缩文件解压</a>
<span class="shixundelect">
<i data-tip-down="删除" class="fa fa-times-circle mr10 color-afafaf"></i>
</span>
</div>
<div>
<a class="shixunsboxfont">命令加密ZPI压缩文件解压</a>
<span class="shixundelect">
<i data-tip-down="删除" class="fa fa-times-circle mr10 color-afafaf"></i>
</span>
</div>
<div>
<a class="shixunsboxfont">命令加密ZPI压缩文件解压</a>
<span class="shixundelect">
<i data-tip-down="删除" class="fa fa-times-circle mr10 color-afafaf"></i>
</span>
</div>
</div>
<div class="fl mb10 shixunsboxs">
<div class="newshixunbox">
<div class="newshixunboxfont">新增实训题</div>
</div>
</div>
<li class="fl clearfix mb20 shixunsboxs">
<p class="mr40">
<a href="javascript:void(0)" class="fr task-btn task-btn-orange" id="add_new_question">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr30">取消</a>
<span class=" fr font-12 color-grey mt5 mr25" style="display: block;">
<span class="color-orange-tip ">温馨提示:</span>[实训题]属于客观题将由系统自动评分
</span>
</p>
</li>
</div>
</div>
<% end %>
<script type="text/javascript">

@ -1,22 +1,22 @@
<div class="mh360">
<table class="edu-pop-table color-grey edu-txt-center table-pa5" cellspacing="0" cellpadding="0">
<thead>
<thead class="block">
<tr>
<th>实训名称</th>
<th>创建者</th>
<th>学员数</th>
<th class="width425p">实训名称</th>
<th class="width100p">创建者</th>
<th class="width100p">级别</th>
</tr>
</thead>
<tbody>
<tbody class="over300 block" id="shixun_list_block">
<% @shixuns.each do |shixun| %>
<tr>
<td class="clearfix" style="padding-left: 20px">
<input name="shixun_exercise" type="checkbox" class="magic-checkbox" id="shixun_input_<%= shixun.id %>" value="<%= shixun.id %>">
<label style="top:2px" for="shixun_input_<%= shixun.id %>"></label>
<td class="clearfix width420p" style="padding-left: 20px">
<input name="shixun_exercise[]" type="checkbox" class="magic-checkbox" id="shixun_input_<%= shixun.id %>" value="<%= shixun.id %>">
<label style="top:2px" for="shixun_input_<%= shixun.id %>"></label>
<%= link_to shixun.name, shixun_path(shixun), :class => "edu-info-dark task-hide mt3 ml20",:style=> "text-align:left", :target => "_blank" %>
</td>
<td><%= link_to shixun.owner.try(:show_name), user_path(shixun.owner), :class => "edu-txt-w140 mt3 task-hide" %></td>
<td><%= shixun.myshixuns.count %></td>
<td class="width100p"><%= link_to shixun.owner.try(:show_name), user_path(shixun.owner), :class => "mt3 task-hide" %></td>
<td class="width100p"><%= shixun.shixun_level %></td>
</tr>
<% end %>
</tbody>
@ -28,10 +28,60 @@
<a href="javascript:void(0);" class="task-btn task-btn-orange fr" onclick="new_shixun_exercise();">选择</a>
<a href="javascript:void(0);" class="task-btn fr pop_close mr10" onclick="hideModal();">取消</a>
</div>
<!--<div class="fl pages_user_show mt10">-->
<!--<ul>-->
<!--<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>-->
<!--</ul>-->
<!--<div class="cl"></div>-->
<!--</div>-->
</div>
<!-- <div class="fl pages_user_show mt10">-->
<!-- <ul>-->
<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
<!-- </ul>-->
<!-- <div class="cl"></div>-->
<!-- </div>-->
</div>
<script>
var i = 1; //设置当前页数
var msg_list_loading = false;
$(function() {
var totalpage = <%= @total_pages.to_i %>; //总页数,防止超过总页数继续滚动
var winH = $(window).height(); //页面可视区域高度
$("#shixun_list_block").scroll(function() {
if (i < totalpage) { // 当滚动的页数小于总页数的时候,继续加载
var pageH = $(document.body).height();
var scrollT = $(window).scrollTop(); //滚动条top
var aa = (pageH - winH - scrollT) / winH;
if ( ! msg_list_loading ){
if (aa < 0.01 ) {
getJson(i+1)
}
}
}
});
});
function getJson(page) {
var msg_list = $('#shixun_list_block');
if (msg_list.height() + msg_list[0].scrollTop >= msg_list[0].scrollHeight - 60) {
msg_list_loading = true;
$.getJSON("<%= choose_shixuns_exercise_path(@exercise) %>&page="+page, function(json) {
if (json) {
msg_list_loading = false;
var str = "";
$.each(json, function(index, array) {
console.log(array);
str = '<tr>' +
' <td class="clearfix" style="padding-left: 20px">' +
' <input name="shixun_exercise[]" type="checkbox" class="magic-checkbox" id="shixun_input_'+array["id"]+'" value="'+array["id"]+'">' +
' <label style="top:2px" for="shixun_input_'+array["id"]+'"></label>' +
' <a href="'+array["shixun_path"]+'" class="edu-info-dark task-hide mt3 ml20" style="text-align:left" target="_blank">'+array["name"]+'</a>' +
' </td>' +
' <td><a href="'+array["owner_path"]+'" class="edu-txt-w140 mt3 task-hide" target="_blank">'+array["shixun_owner"]+'</a></td>' +
' <td>'+array["shixun_level"]+'</td>' +
' </tr>';
$("#shixun_list_block").append(str);
});
i ++;
}
});
}
}
</script>

@ -1,6 +1,8 @@
<%= render :partial => "graduation_tasks/task_tag", :locals => {:task => task} %>
<% from_course = defined?(is_course) ? true : false %>
<% if false %>
<% if @is_teacher %>
<div class="<%= from_course ? 'fr mr20 edu-menu-panel' : 'fr edu-position-hidebox' %>" style="<%= from_course ? '' : 'position: absolute;right: 0px;top: 0px;'%>">
<% if from_course %>
@ -61,4 +63,5 @@
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>

@ -62,6 +62,8 @@
<% end %>
<%# elsif homework_common.homework_type != 4 %>
<% else %>
<% if false %>
<% if had_commit_studentwork_count(homework_common) > 0 %>
<span class="ml50 fl">
<%= link_to had_commit_studentwork_count(homework_common), student_work_index_path(:homework => homework_common.id), :class => 'color-orange03 mr5', :target => '_blank' %>
@ -77,6 +79,7 @@
未交
</span>
<% end %>
<% end %>
<%# elsif homework_common.homework_type == 4 && homework_common.homework_commons_shixuns.shixun %>
<%# had_passed_count = had_passed_changllenge_count(homework_common.homework_commons_shixuns.shixun, User.current) %>
<%# challenge_count = homework_common.homework_commons_shixuns.shixun.challenges.count %>
@ -148,7 +151,7 @@
<li>
<%= link_to '立即发布', publish_notice_homework_common_path(homework_common), :remote => true %>
</li>
<% elsif (homework_common.homework_detail_manual.try(:comment_status) == 1 || homework_common.homework_detail_manual.try(:comment_status) == 2) && homework_common.end_time > Time.now %>
<% elsif (homework_common.homework_detail_manual.try(:comment_status) == 1 || homework_common.homework_detail_manual.try(:comment_status) == 2) && homework_common.end_time.present? && homework_common.end_time > Time.now %>
<li>
<%= link_to '立即截止', end_notice_homework_common_path(homework_common), :remote => true %>
</li>

@ -1,13 +1,15 @@
<% course_board = @course.boards.where(:parent_id => 0).first %>
<% count = course_board ? course_board.messages.count : 0 %>
<li class="clearfix" id="sy_02">
<% if course_module.module_name != course_board.name %>
<% course_board.update_name(course_module.module_name) %>
<% end %>
<a href="<%= course_boards_path(@course) %>" class="fl"><i class="iconfont icon-taolun mr20 fl"></i>
<span class="task-hide activity-left-name"><%= course_module.module_name %></span>
<% if count > 0 %>
<span class="fr mr30 courseNewNum"><%= count %></span>
<% if is_teacher %>
<% count = course_board ? course_board.messages.count : 0 %>
<% if count > 0 %>
<span class="fr mr30 courseNewNum"><%= count %></span>
<% end %>
<% end %>
</a>
</li>
@ -15,10 +17,12 @@
<ul>
<% course_board.children.reorder("position asc").each do |board| %>
<li id="board_children_<%= board.id %>" class="clearfix">
<% count = board ? board.messages.count : 0 %>
<a href="<%= course_boards_path(@course, :board_id => board.id) %>" class="fl"><span class="fl ml38 devide_class task-hide" data-tip-down="<%=board.name %>"><%=board.name %></span>
<% if count > 0 %>
<span class="fr mr30 courseNewNum"><%= count %></span>
<% if is_teacher %>
<% count = board ? board.messages.count : 0 %>
<% if count > 0 %>
<span class="fr mr30 courseNewNum"><%= count %></span>
<% end %>
<% end %>
</a>
</li>

@ -1,9 +1,11 @@
<li id="sy_08" class="clearfix">
<a href="<%= students_course_path(@course) %>" class="fl"><i class="iconfont icon-fenban mr20 fl"></i><span class="fl task-hide activity-left-name"><%= @course.course_modules.where(:module_type => "course_group").first.try(:module_name) %></span>
<% group_count = @course.course_groups.size %>
<% if group_count > 0 %>
<span class="fl ml10 color-grey-9 font-12 groupNum"><%= group_count %></span>
<% end %>
<% if is_teacher %>
<% group_count = @course.course_groups.size %>
<% if group_count > 0 %>
<span class="fl ml10 color-grey-9 font-12 groupNum"><%= group_count %></span>
<% end %>
<% end %>
</a>
</li>
<% unless @course.course_groups.empty? %>
@ -13,17 +15,21 @@
<% if count > 0 %>
<li id="sy_09" class="clearfix">
<a href="<%= students_course_path(@course, :group_id => 0) %>" class="fl" style="color:000 !important;"><span class="fl ml38 devide_class task-hide" data-tip-down="未分班" style="color:000 !important;">未分班</span>
<span class="fl ml10 color-grey-9 font-12 groupNum"><%= count %></span>
<% if is_teacher %>
<span class="fl ml10 color-grey-9 font-12 groupNum"><%= count %></span>
<% end %>
</a>
</li>
<% end %>
<% @course.course_groups.each do |group| %>
<li id="course_group_<%=group.id %>" class="clearfix">
<% count = group.members.count %>
<a href="<%= students_course_path(@course, :group_id => group.id) %>" class="fl"><span class="fl ml38 devide_class task-hide" data-tip-down="<%=group.name %>"><%=group.name %></span>
<% if count > 0 %>
<span class="fl ml10 color-grey-9 font-12 groupNum"><%= count %></span>
<% end %>
<% if is_teacher %>
<% count = group.members.count %>
<% if count > 0 %>
<span class="fl ml10 color-grey-9 font-12 groupNum"><%= count %></span>
<% end %>
<% end %>
</a>
</li>
<% end %>

@ -1,4 +1,3 @@
<% course_file_num = visable_attachemnts_incourse(@course).size %>
<% course_modules = @course.course_modules.where(:hidden => 0) %>
<%# is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<%# homework_num = visable_course_homework @course %>
@ -64,9 +63,11 @@
<% when "shixun_homework" %>
<li class="clearfix" id="sy_03_4">
<a href="<%= homework_common_index_path(:course => @course.id, :homework_type => 4) %>" class="fl"><i class="iconfont icon-daima mr20 fl"></i><span class="task-hide activity-left-name"><%= course_module.module_name %></span>
<% homework_count = visable_course_homework(@course, 4, @is_teacher, nil) %>
<% if homework_count > 0 %>
<span class="fr mr30 courseNewNum"><%= homework_count %></span>
<% if @is_teacher %>
<% homework_count = visable_course_homework(@course, 4, @is_teacher, nil) %>
<% if homework_count > 0 %>
<span class="fr mr30 courseNewNum"><%= homework_count %></span>
<% end %>
<% end %>
</a>
</li>
@ -74,18 +75,22 @@
<% when "common_homework" %>
<li class="clearfix" id="sy_03_1">
<a href="<%= homework_common_index_path(:course => @course.id, :homework_type => 1) %>" class="fl"><i class="iconfont icon-putongzuoye mr20 fl"></i><span class="task-hide activity-left-name"><%= course_module.module_name %></span>
<% homework_count = visable_course_homework(@course, 1, @is_teacher, nil) %>
<% if homework_count > 0 %>
<span class="fr mr30 courseNewNum"><%= homework_count %></span>
<% if @is_teacher %>
<% homework_count = visable_course_homework(@course, 1, @is_teacher, nil) %>
<% if homework_count > 0 %>
<span class="fr mr30 courseNewNum"><%= homework_count %></span>
<% end %>
<% end %>
</a>
</li>
<% when "group_homework" %>
<li class="clearfix" id="sy_03_3">
<a href="<%= homework_common_index_path(:course => @course.id, :homework_type => 3) %>" class="fl"><i class="iconfont icon-fenzuzuoye mr20 fl"></i><span class="task-hide activity-left-name"><%= course_module.module_name %></span>
<% homework_count = visable_course_homework(@course, 3, @is_teacher, nil) %>
<% if homework_count > 0 %>
<span class="fr mr30 courseNewNum"><%= homework_count %></span>
<% if @is_teacher %>
<% homework_count = visable_course_homework(@course, 3, @is_teacher, nil) %>
<% if homework_count > 0 %>
<span class="fr mr30 courseNewNum"><%= homework_count %></span>
<% end %>
<% end %>
</a>
</li>
@ -96,53 +101,65 @@
</li>
<ul>
<li id="sy_07_01" class="clearfix">
<% count = @course.graduation_topics.count %>
<a href="<%= graduation_topics_path(:course => @course.id) %>" class="fl">
<span class="fl ml38 devide_class task-hide">毕设选题</span>
<% if count > 0 %>
<span class="fr mr30 courseNewNum"><%= count %></span>
<% if @is_teacher %>
<% count = @course.graduation_topics.count %>
<% if count > 0 %>
<span class="fr mr30 courseNewNum"><%= count %></span>
<% end %>
<% end %>
</a>
</li>
<li id="sy_07_02" class="clearfix">
<% count = visible_task_count @course, @is_teacher %>
<a href="<%= graduation_tasks_path(:course => @course.id) %>" class="fl">
<span class="fl ml38 devide_class task-hide">毕设任务</span>
<% if count > 0 %>
<span class="fr mr30 courseNewNum"><%= count %></span>
<% if @is_teacher %>
<% count = visible_task_count @course, @is_teacher %>
<% if count > 0 %>
<span class="fr mr30 courseNewNum"><%= count %></span>
<% end %>
<% end %>
</a>
</li>
</ul>
<% when "exercise" %>
<% count = visable_course_exercise @course, @is_teacher %>
<li class="clearfix" id="sy_04">
<a href="<%= exercise_index_path(:course_id => @course.id) %>" class="fl"><i class="iconfont icon-shijuan mr20 fl"></i><span class="task-hide activity-left-name"><%= course_module.module_name %></span>
<% if count > 0 %>
<span class="fr mr30 courseNewNum"><%= count %></span>
<% if @is_teacher %>
<% count = visable_course_exercise @course, @is_teacher %>
<% if count > 0 %>
<span class="fr mr30 courseNewNum"><%= count %></span>
<% end %>
<% end %>
</a>
</li>
<% when "poll" %>
<% count = visable_course_poll @course, @is_teacher %>
<li class="clearfix" id="sy_06">
<a href="<%= poll_index_path(:course_id => @course.id) %>" class="fl"><i class="iconfont icon-wenjuan mr20 fl"></i><span class="task-hide activity-left-name"><%= course_module.module_name %></span>
<% if count > 0 %>
<span class="fr mr30 courseNewNum"><%= count %></span>
<% if @is_teacher %>
<% count = visable_course_poll @course, @is_teacher %>
<% if count > 0 %>
<span class="fr mr30 courseNewNum"><%= count %></span>
<% end %>
<% end %>
</a>
</li>
<% when "attachment" %>
<li class="clearfix" id="sy_05">
<a href="<%= course_files_path(@course) %>" class="fl"><i class="iconfont icon-ziyuan mr20 fl"></i><span class="task-hide activity-left-name"><%= course_module.module_name %></span>
<% if course_file_num > 0 %>
<span class="fr mr30 courseNewNum"><%= course_file_num %></span>
<% if @is_teacher %>
<% course_file_num = visable_attachemnts_incourse(@course).size %>
<% if course_file_num > 0 %>
<span class="fr mr30 courseNewNum"><%= course_file_num %></span>
<% end %>
<% end %>
</a>
</li>
<% when "board" %>
<div id="board_children_list">
<%= render :partial => 'layouts/board_children_list', :locals => {:course_module => course_module} %>
<%= render :partial => 'layouts/board_children_list', :locals => {:course_module => course_module,
:is_teacher => @is_teacher} %>
</div>
<% when "course_group" %>
<div id="group_children_list">

@ -1,5 +1,14 @@
<% @partners.each_with_index do |partner,index| %>
<li>
<%= link_to "#{partner.name}", partners_managements_path(:partner => partner), :class => "#{partner.id == @current_partner.id ? 'active' : ''}" %>
<li class="clearfix">
<%= link_to "#{partner.name}", partners_managements_path(:partner => partner), :class => "#{partner.id == @current_partner.id ? 'active' : ''} fl" %>
<% if false %>
<div class="fr mr10 edu-menu-panel mt5">
<i class="iconfont icon-sandian color-grey-9 font-14"></i>
<ul class="edu-menuSmall-list edu-txt-center">
<li><a href="javascript:void(0)">查看</a></li>
<li><a href="javascript:void(0)" onclick="delPartners();">删除</a></li>
</ul>
</div>
<% end %>
</li>
<% end %>
<% end %>

@ -5,7 +5,7 @@
<a href="javascript:void(0)" class="fl task-btn ml10" onclick="$('#partner_search').val('')">清除</a>
</div>
<div class="clearfix mt20">
<div class="with25 fl edu-back-white">
<div class="with25 fl">
<%= link_to "+添加",all_partners_managements_path,remote:true,class:"color-blue addOperation" %>
<ul class="partnerList" id="partner_list">
<%= render :partial => "partner_list" %>
@ -29,4 +29,9 @@
function submit_search_partner(){
$.get("/managements/partners?search="+$("#partner_search").val());
}
function delPartners(){
delete_confirm_box_2("","确定删除合作伙伴?");
}
</script>

@ -15,6 +15,7 @@
<% end %>
<% end %>
<% if false %>
<% if @is_teacher %>
<div class="fr mr20 edu-menu-panel">
<i class="iconfont icon-caidan color-blue"></i>
@ -68,6 +69,8 @@
<% end %>
<% end %>
<% end %>
<% end %>
</div>
<p>
<%= link_to activity.user.show_real_name, user_path(activity.user), :class => "color-grey-6 mr30" %>

@ -13,6 +13,7 @@
<span class="edu-filter-btn edu-filter-btn-no-late ml10 fl mt6">已确认</span>
<% end %>
<% if false %>
<% if @is_teacher %>
<div class="fr mr20 edu-menu-panel">
<i class="iconfont icon-caidan color-blue"></i>
@ -33,6 +34,7 @@
<a href="javascript:void(0);" onclick="s_op_confirm_box('<%= cancel_topic_select_graduation_topic_path(activity) %>', '确定要取消该选题吗')" class="edu-filter-btn edu-greyback-btn fl mt7 pl3 pr3 ml10 pointer">取消选题</a>
<% end %>
<% end %>
<% end %>
</div>
<p>
<%= link_to activity.teacher.show_real_name, user_path(activity.teacher), :class => "color-grey-6 mr30" %>

@ -25,115 +25,91 @@
<% end %>
<% end %>
<% if @is_teacher %>
<% comment_status = activity.homework_detail_manual.try(:comment_status) %>
<div class="fr mr20 edu-menu-panel">
<i class="iconfont icon-caidan color-blue"></i>
<ul class="edu-menuSmall-list edu-txt-center">
<% if activity.homework_type != 4 %>
<li><%= link_to "编辑", edit_homework_common_path(activity) %></li>
<% end %>
<li><%= link_to "设置", student_work_index_path(:homework => activity.id, :tab => 4) %></li>
<% if comment_status == 0 || activity.homework_group_settings.where("publish_time is null or publish_time > '#{Time.now}'").count > 0 %>
<li><%= link_to '立即发布', publish_notice_homework_common_path(activity), :remote => true %></li>
<% end %>
<% if (comment_status == 1 && activity.end_time > Time.now) || activity.homework_group_settings.where("publish_time < '#{Time.now}' and end_time > '#{Time.now}'").count > 0 %>
<li><%= link_to '立即截止', end_notice_homework_common_path(activity), :remote => true %></li>
<% end %>
<li><%= link_to "导出成绩", student_work_index_path(:homework => activity, :format => 'xls'), :id => "export_student_work" %></li>
<% if activity.homework_type == 1 || activity.homework_type == 3 %>
<% if false %>
<% if @is_teacher %>
<% comment_status = activity.homework_detail_manual.try(:comment_status) %>
<div class="fr mr20 edu-menu-panel">
<i class="iconfont icon-caidan color-blue"></i>
<ul class="edu-menuSmall-list edu-txt-center">
<% if activity.homework_type != 4 %>
<li><%= link_to "编辑", edit_homework_common_path(activity) %></li>
<% end %>
<li><%= link_to "设置", student_work_index_path(:homework => activity.id, :tab => 4) %></li>
<% if comment_status == 0 || activity.homework_group_settings.where("publish_time is null or publish_time > '#{Time.now}'").count > 0 %>
<li><%= link_to '立即发布', publish_notice_homework_common_path(activity), :remote => true %></li>
<% end %>
<% if (comment_status == 1 && activity.end_time > Time.now) || activity.homework_group_settings.where("publish_time < '#{Time.now}' and end_time > '#{Time.now}'").count > 0 %>
<li><%= link_to '立即截止', end_notice_homework_common_path(activity), :remote => true %></li>
<% end %>
<li><%= link_to "导出成绩", student_work_index_path(:homework => activity, :format => 'xls'), :id => "export_student_work" %></li>
<% if activity.homework_type == 1 || activity.homework_type == 3 %>
<li>
<% if activity.student_works.has_committed.empty? %>
<a href="javascript:void(0)" onclick="notice_box('没有学生提交作业,暂无附件可下载');">导出作品附件</a>
<% else %>
<%= link_to "导出作品附件", zipdown_assort_path(obj_class: activity.class, obj_id: activity.id, format: :json), remote: true, :class => "download_homework_attachments" %>
<% end %>
</li>
<% end %>
<% if @course.is_public? && !activity.is_public %>
<li id="set_homework_public_<%= activity.id %>">
<a href="javascript:void(0);" onclick="delete_confirm_box('<%= set_public_homework_common_path(activity) %>', '您确定要公开吗?<br/>公开后不能重设为私有')">设为公开</a>
</li>
<% end %>
<% if (activity.homework_type == 1 || activity.homework_type == 3) && (@is_teacher || activity.user == User.current) %>
<li class="add_to_homework_bank_<%= activity.id %>">
<%= link_to "加入题库", add_to_homework_bank_homework_common_path(activity), :remote => true %>
</li>
<% end %>
<li>
<% if activity.student_works.has_committed.empty? %>
<a href="javascript:void(0)" onclick="notice_box('没有学生提交作业,暂无附件可下载');">导出作品附件</a>
<% else %>
<%= link_to "导出作品附件", zipdown_assort_path(obj_class: activity.class, obj_id: activity.id, format: :json), remote: true, :class => "download_homework_attachments" %>
<% end %>
</li>
<% end %>
<% if @course.is_public? && !activity.is_public %>
<li id="set_homework_public_<%= activity.id %>">
<a href="javascript:void(0);" onclick="delete_confirm_box('<%= set_public_homework_common_path(activity) %>', '您确定要公开吗?<br/>公开后不能重设为私有')">设为公开</a>
</li>
<% end %>
<% if (activity.homework_type == 1 || activity.homework_type == 3) && (@is_teacher || activity.user == User.current) %>
<li class="add_to_homework_bank_<%= activity.id %>">
<%= link_to "加入题库", add_to_homework_bank_homework_common_path(activity), :remote => true %>
<a href="javascript:void(0)" onclick="delete_confirm_box_3('<%= homework_common_path(activity) %>', '您确定要删除吗?<br/>已提交作品将全部被删除,不可恢复')">删除</a>
</li>
<% end %>
<li>
<a href="javascript:void(0)" onclick="delete_confirm_box_3('<%= homework_common_path(activity) %>', '您确定要删除吗?<br/>已提交作品将全部被删除,不可恢复')">删除</a>
</li>
</ul>
</div>
</ul>
</div>
<% elsif User.current.member_of_course?(activity.course) %>
<% work = cur_user_works_for_homework activity %>
<% member = activity.course.members.where(:user_id => User.current.id).first
setting_time = homework_group_setting activity, member.try(:course_group_id) %>
<% project = cur_user_projects_for_homework activity %>
<% if activity.course.is_end %>
<span class="edu-filter-btn <%= homework_status_color "已结束" %> ml15 fl mt5">已结束</span>
<% if work.present? %>
<%= link_to "查看作品", student_work_index_path(:homework => activity.id), :class => 'edu-filter-btn edu-activity-green ml15 fl mt5' %>
<% end %>
<% else %>
<% if activity.homework_type == 4 %>
<% if work.nil? && (setting_time.end_time >= Time.now || activity.allow_late) %>
<%= link_to "开始实战", shixun_path(activity.homework_commons_shixuns.shixun), :class => 'edu-filter-btn edu-activity-blue ml15 fl mt5', :target => "_blank" %>
<% elsif work.present? %>
<% myshixun = Myshixun.where(:id => work.myshixun_id).first %>
<%# is_modify = ShixunModify.where(:myshixun_id => myshixun.try(:id), :shixun_id => myshixun.shixun.try(:id), :status => 1).first %>
<% if myshixun.present? %>
<%= link_to "继续实战", shixun_path(myshixun.shixun), :class => "edu-filter-btn edu-activity-blue ml15 fl mt5", :target => "_blank" %>
<% end %>
<% elsif User.current.member_of_course?(activity.course) %>
<% work = cur_user_works_for_homework activity %>
<% member = activity.course.members.where(:user_id => User.current.id).first
setting_time = homework_group_setting activity, member.try(:course_group_id) %>
<% project = cur_user_projects_for_homework activity %>
<% if activity.course.is_end %>
<span class="edu-filter-btn <%= homework_status_color "已结束" %> ml15 fl mt5">已结束</span>
<% if work.present? %>
<%= link_to "查看作品", student_work_index_path(:homework => activity.id), :class => 'edu-filter-btn edu-activity-green ml15 fl mt5' %>
<% end %>
<% else %>
<% if activity.homework_type == 4 %>
<% if work.nil? && (setting_time.end_time >= Time.now || activity.allow_late) %>
<%= link_to "开始实战", shixun_path(activity.homework_commons_shixuns.shixun), :class => 'edu-filter-btn edu-activity-blue ml15 fl mt5', :target => "_blank" %>
<% elsif work.present? %>
<% myshixun = Myshixun.where(:id => work.myshixun_id).first %>
<%# is_modify = ShixunModify.where(:myshixun_id => myshixun.try(:id), :shixun_id => myshixun.shixun.try(:id), :status => 1).first %>
<% if myshixun.present? %>
<%= link_to "继续实战", shixun_path(myshixun.shixun), :class => "edu-filter-btn edu-activity-blue ml15 fl mt5", :target => "_blank" %>
<% end %>
<%# if myshixun && is_modify.blank? %>
<%# if myshixun && is_modify.blank? %>
<%#= link_to "继续实战", shixun_exec_shixun_path(myshixun.shixun), :class => "edu-filter-btn edu-activity-blue ml15 fl mt5", :target => "_blank" %>
<%# elsif myshixun %>
<%# elsif myshixun %>
<%#= link_to "继续实战", 'javascript:void(0);', :onclick => "sure_box_redirect('#{myshixun_reset_myshixun_path(myshixun)}', '实训已经更新啦,系统正在为您重置');", :class => "edu-filter-btn edu-activity-blue ml15 fl mt5" %>
<%# end %>
<% else %>
<span class="edu-filter-btn <%= homework_status_color "未开启补交" %> ml15 fl mt5">未开启补交</span>
<% end %>
<% elsif work.nil? && setting_time.end_time >= Time.now %>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<% if project.nil? %>
<%= link_to "关联项目", new_student_work_project_student_work_index_path(:homework => activity.id, :user_activity_id => user_activity_id, :hw_status => hw_status), remote: true, :class => 'edu-filter-btn edu-activity-blue ml15 fl mt5', :title => '请各组长关联作业项目' %>
<%= link_to "提交作品", "javascript:void(0)", :class => 'edu-filter-btn edu-activity-blue ml15 fl mt5', :style => "cursor:not-allowed", :title => '请先关联项目再提交作品' %>
<%# end %>
<% else %>
<a href="javascript:void(0);" class="edu-filter-btn edu-activity-light-grey ml15 fl mt5" title="取消关联项目" onclick="delete_confirm_box('<%= cancel_relate_project_student_work_index_path(:homework => activity.id,:user_activity_id=>user_activity_id, :hw_status => hw_status) %>', '您确定要取消关联吗?')">取消关联</a>
<%= link_to "提交作品", new_student_work_url_without_domain(activity.id), :class => 'edu-filter-btn edu-activity-blue ml15 fl mt5' %>
<span class="edu-filter-btn <%= homework_status_color "未开启补交" %> ml15 fl mt5">未开启补交</span>
<% end %>
<% else %>
<%= link_to "提交作品", new_student_work_url_without_domain(activity.id), :class => 'edu-filter-btn edu-activity-blue ml15 fl mt5' %>
<% end %>
<% elsif work.nil? %>
<% if activity.anonymous_comment == 1 || activity.homework_detail_manual.try(:comment_status).to_i < 3 %>
<% if activity.allow_late && activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<% elsif work.nil? && setting_time.end_time >= Time.now %>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<% if project.nil? %>
<%= link_to "关联项目", new_student_work_project_student_work_index_path(:homework => activity.id, :user_activity_id => user_activity_id, :hw_status => hw_status), remote: true, :class => 'edu-filter-btn edu-activity-blue ml15 fl mt5', :title => '请各组长关联作业项目' %>
<%= link_to "提交作品", "javascript:void(0)", :class => 'edu-filter-btn edu-activity-blue ml15 fl mt5', :style => "cursor:not-allowed", :title => '请先关联项目再提交作品' %>
<% else %>
<a href="javascript:void(0);" class="edu-filter-btn edu-activity-light-grey ml15 fl mt5" title="取消关联项目" onclick="delete_confirm_box('<%= cancel_relate_project_student_work_index_path(:homework => activity.id,:user_activity_id=>user_activity_id, :hw_status => hw_status) %>', '您确定要取消关联吗?')">取消关联</a>
<%= link_to "提交作品", new_student_work_url_without_domain(activity.id), :class => 'edu-filter-btn edu-activity-blue ml15 fl mt5' %>
<% end %>
<% else %>
<%= link_to "提交作品", new_student_work_url_without_domain(activity.id), :class => 'edu-filter-btn edu-activity-blue ml15 fl mt5' %>
<% end %>
<%= un_commit_work_status project, activity %>
<% else %>
<% if activity.homework_detail_manual.try(:comment_status).to_i == 3 %>
<span class="edu-filter-btn <%= homework_status_color "匿评中" %> ml15 fl mt5">匿评中</span>
<% if activity.allow_late && activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<% if project.nil? %>
<%= link_to "关联项目", new_student_work_project_student_work_index_path(:homework => activity.id, :user_activity_id => user_activity_id, :hw_status => hw_status), remote: true, :class => 'edu-filter-btn edu-activity-blue ml15 fl mt5', :title => '请各组长关联作业项目' %>
<% else %>
<a href="javascript:void(0);" class="edu-filter-btn edu-activity-light-grey ml15 fl mt5" title="取消关联项目" onclick="delete_confirm_box('<%= cancel_relate_project_student_work_index_path(:homework => activity.id,:user_activity_id=>user_activity_id, :hw_status => hw_status) %>', '您确定要取消关联吗?')">取消关联</a>
<% end %>
<% end %>
<%= un_commit_work_status project, activity %>
<% elsif activity.homework_detail_manual.try(:comment_status).to_i == 4 || activity.homework_detail_manual.try(:comment_status).to_i > 4 %>
<% if activity.homework_detail_manual.try(:comment_status).to_i == 4 %>
<span class="edu-filter-btn <%= homework_status_color "申诉中" %> ml15 fl mt5">申诉中</span>
<% else %>
<span class="edu-filter-btn <%= homework_status_color "评阅中" %> ml15 fl mt5">评阅中</span>
<% end %>
<% elsif work.nil? %>
<% if activity.anonymous_comment == 1 || activity.homework_detail_manual.try(:comment_status).to_i < 3 %>
<% if activity.allow_late && activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<% if project.nil? %>
<%= link_to "关联项目", new_student_work_project_student_work_index_path(:homework => activity.id, :user_activity_id => user_activity_id, :hw_status => hw_status), remote: true, :class => 'edu-filter-btn edu-activity-blue ml15 fl mt5', :title => '请各组长关联作业项目' %>
@ -142,48 +118,74 @@
<% end %>
<% end %>
<%= un_commit_work_status project, activity %>
<% end %>
<% end %>
<% elsif work.present? %>
<% if setting_time.end_time >= Time.now %>
<span class="edu-filter-btn <%= homework_status_color "提交中" %> ml15 fl mt5">提交中</span>
<%= link_to "修改作品", edit_student_work_url_without_domain(work.id), :class => 'edu-filter-btn edu-activity-orange ml15 fl mt5' %>
<% else %>
<% if activity.anonymous_comment == 1 || activity.homework_detail_manual.try(:comment_status).to_i < 3 %>
<%= late_commit_work_status work, activity %>
<%= link_to "查看作品", student_work_path(work), :class => 'edu-filter-btn edu-activity-green ml15 fl mt5' %>
<% else %>
<% work_ids = "(" + activity.student_works.has_committed.map(&:id).join(",") + ")" %>
<% if activity.homework_detail_manual.try(:comment_status).to_i == 3 %>
<% if activity.allow_late %>
<% if User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0 %>
<%= link_to "补交附件", student_work_path(work, :is_focus => 1), :class => 'edu-filter-btn edu-activity-orange ml15 fl mt5', :title => "可追加作品修订附件" %>
<% link_to "匿评作品", student_work_index_path(:homework => activity.id), :class => 'edu-filter-btn edu-activity-grey ml15 fl mt5', :title => "开启匿评后不可修改作品" %>
<% else %>
<span class="edu-filter-btn <%= homework_status_color "匿评中" %> ml15 fl mt5">匿评中</span>
<%= link_to "补交附件", student_work_path(work, :is_focus => 1), :class => 'edu-filter-btn edu-activity-orange ml15 fl mt5', :title => "可追加作品修订附件" %>
<% end %>
<% else %>
<% if User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0 %>
<span class="edu-filter-btn <%= homework_status_color "未开启补交" %> ml15 fl mt5">未开启补交</span>
<% link_to "匿评作品", student_work_index_path(:homework => activity.id), :class => 'edu-filter-btn edu-activity-grey ml15 fl mt5', :title => "开启匿评后不可修改作品" %>
<span class="edu-filter-btn <%= homework_status_color "匿评中" %> ml15 fl mt5">匿评中</span>
<% if activity.allow_late && activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<% if project.nil? %>
<%= link_to "关联项目", new_student_work_project_student_work_index_path(:homework => activity.id, :user_activity_id => user_activity_id, :hw_status => hw_status), remote: true, :class => 'edu-filter-btn edu-activity-blue ml15 fl mt5', :title => '请各组长关联作业项目' %>
<% else %>
<span class="edu-filter-btn <%= homework_status_color "匿评中" %> ml15 fl mt5">匿评中</span>
<span class="edu-filter-btn <%= homework_status_color "未开启补交" %> ml15 fl mt5">未开启补交</span>
<a href="javascript:void(0);" class="edu-filter-btn edu-activity-light-grey ml15 fl mt5" title="取消关联项目" onclick="delete_confirm_box('<%= cancel_relate_project_student_work_index_path(:homework => activity.id,:user_activity_id=>user_activity_id, :hw_status => hw_status) %>', '您确定要取消关联吗?')">取消关联</a>
<% end %>
<% end %>
<%= un_commit_work_status project, activity %>
<% elsif activity.homework_detail_manual.try(:comment_status).to_i == 4 || activity.homework_detail_manual.try(:comment_status).to_i > 4 %>
<% if activity.homework_detail_manual.try(:comment_status).to_i == 4 %>
<span class="edu-filter-btn <%= homework_status_color "申诉中" %> ml15 fl mt5">申诉中</span>
<% else %>
<span class="edu-filter-btn <%= homework_status_color "评阅中" %> ml15 fl mt5">评阅中</span>
<% end %>
<% if activity.allow_late %>
<%= link_to "补交附件", student_work_path(work, :is_focus => 1), :class => 'edu-filter-btn edu-activity-orange ml15 fl mt5', :title => "可追加作品修订附件" %>
<%= link_to "查看作品", student_work_path(work), :class => 'edu-filter-btn edu-activity-green ml15 fl mt5' %>
<% else %>
<span class="edu-filter-btn <%= homework_status_color "未开启补交" %> ml15 fl mt5">未开启补交</span>
<%= link_to "查看作品", student_work_path(work), :class => 'edu-filter-btn edu-activity-green ml15 fl mt5' %>
<% if activity.allow_late && activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<% if project.nil? %>
<%= link_to "关联项目", new_student_work_project_student_work_index_path(:homework => activity.id, :user_activity_id => user_activity_id, :hw_status => hw_status), remote: true, :class => 'edu-filter-btn edu-activity-blue ml15 fl mt5', :title => '请各组长关联作业项目' %>
<% else %>
<a href="javascript:void(0);" class="edu-filter-btn edu-activity-light-grey ml15 fl mt5" title="取消关联项目" onclick="delete_confirm_box('<%= cancel_relate_project_student_work_index_path(:homework => activity.id,:user_activity_id=>user_activity_id, :hw_status => hw_status) %>', '您确定要取消关联吗?')">取消关联</a>
<% end %>
<% end %>
<%= un_commit_work_status project, activity %>
<% end %>
<% end %>
<% elsif work.present? %>
<% if setting_time.end_time >= Time.now %>
<span class="edu-filter-btn <%= homework_status_color "提交中" %> ml15 fl mt5">提交中</span>
<%= link_to "修改作品", edit_student_work_url_without_domain(work.id), :class => 'edu-filter-btn edu-activity-orange ml15 fl mt5' %>
<% else %>
<% if activity.anonymous_comment == 1 || activity.homework_detail_manual.try(:comment_status).to_i < 3 %>
<%= late_commit_work_status work, activity %>
<%= link_to "查看作品", student_work_path(work), :class => 'edu-filter-btn edu-activity-green ml15 fl mt5' %>
<% else %>
<% work_ids = "(" + activity.student_works.has_committed.map(&:id).join(",") + ")" %>
<% if activity.homework_detail_manual.try(:comment_status).to_i == 3 %>
<% if activity.allow_late %>
<% if User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0 %>
<%= link_to "补交附件", student_work_path(work, :is_focus => 1), :class => 'edu-filter-btn edu-activity-orange ml15 fl mt5', :title => "可追加作品修订附件" %>
<% link_to "匿评作品", student_work_index_path(:homework => activity.id), :class => 'edu-filter-btn edu-activity-grey ml15 fl mt5', :title => "开启匿评后不可修改作品" %>
<% else %>
<span class="edu-filter-btn <%= homework_status_color "匿评中" %> ml15 fl mt5">匿评中</span>
<%= link_to "补交附件", student_work_path(work, :is_focus => 1), :class => 'edu-filter-btn edu-activity-orange ml15 fl mt5', :title => "可追加作品修订附件" %>
<% end %>
<% else %>
<% if User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0 %>
<span class="edu-filter-btn <%= homework_status_color "未开启补交" %> ml15 fl mt5">未开启补交</span>
<% link_to "匿评作品", student_work_index_path(:homework => activity.id), :class => 'edu-filter-btn edu-activity-grey ml15 fl mt5', :title => "开启匿评后不可修改作品" %>
<% else %>
<span class="edu-filter-btn <%= homework_status_color "匿评中" %> ml15 fl mt5">匿评中</span>
<span class="edu-filter-btn <%= homework_status_color "未开启补交" %> ml15 fl mt5">未开启补交</span>
<% end %>
<% end %>
<% elsif activity.homework_detail_manual.try(:comment_status).to_i == 4 || activity.homework_detail_manual.try(:comment_status).to_i > 4 %>
<% if activity.homework_detail_manual.try(:comment_status).to_i == 4 %>
<span class="edu-filter-btn <%= homework_status_color "申诉中" %> ml15 fl mt5">申诉中</span>
<% else %>
<span class="edu-filter-btn <%= homework_status_color "评阅中" %> ml15 fl mt5">评阅中</span>
<% end %>
<% if activity.allow_late %>
<%= link_to "补交附件", student_work_path(work, :is_focus => 1), :class => 'edu-filter-btn edu-activity-orange ml15 fl mt5', :title => "可追加作品修订附件" %>
<%= link_to "查看作品", student_work_path(work), :class => 'edu-filter-btn edu-activity-green ml15 fl mt5' %>
<% else %>
<span class="edu-filter-btn <%= homework_status_color "未开启补交" %> ml15 fl mt5">未开启补交</span>
<%= link_to "查看作品", student_work_path(work), :class => 'edu-filter-btn edu-activity-green ml15 fl mt5' %>
<% end %>
<% end %>
<% end %>
<% end %>

@ -8,6 +8,8 @@
<% if activity.sticky == 1%>
<span class="fl btn-cir btn-cir-red mt5 ml15">置顶</span>
<% end%>
<% if false %>
<% if @is_teacher %>
<div class="fr mr20 edu-menu-panel">
<i class="iconfont icon-caidan color-blue"></i>
@ -25,6 +27,8 @@
</ul>
</div>
<% end%>
<% end %>
</div>
<p>
<%= link_to activity.author.show_real_name, user_path(activity.author), :class => "color-grey-6 mr30" %>

@ -10,12 +10,13 @@
<% end %>
<% if @is_teacher || !User.current.member_of_course?(activity.course) %>
<% ex_curr_status = poll_curr_time activity %>
<% if ex_curr_status[:status] != "" %>
<span class="edu-filter-btn <%= homework_status_color ex_curr_status[:status] %> ml15 fl mt5"><%= ex_curr_status[:status] %></span>
<% end %>
<% ex_curr_status = poll_curr_time activity %>
<% if ex_curr_status[:status] != "" %>
<span class="edu-filter-btn <%= homework_status_color ex_curr_status[:status] %> ml15 fl mt5"><%= ex_curr_status[:status] %></span>
<% end %>
<% end %>
<% if false %>
<% if @is_teacher %>
<div class="fr mr20 edu-menu-panel">
<i class="iconfont icon-caidan color-blue"></i>
@ -63,6 +64,8 @@
<%= link_to "开始答题", poll_path(activity,:user_id => User.current.id), :class => "edu-activity-blue edu-filter-btn ml15 fl mt5" %>
<% end %>
<% end%>
<% end %>
</div>
<p>
<%= link_to activity.user.show_real_name, user_path(activity.user), :class => "color-grey-6 mr30" %>

@ -0,0 +1,19 @@
class CreateExerciseLevelSettings < ActiveRecord::Migration
def change
create_table :exercise_level_settings do |t|
t.references :exercise
t.integer :level, default: 1
t.integer :score, default: 0
t.integer :num, default: 0
t.timestamps
end
add_index :exercise_level_settings, :exercise_id
Exercise.find_each do |exercise|
shixun_questions = exercise.exercise_questions.where(question_type: 5)
exercise.exercise_level_settings << ExerciseLevelSetting.new(level: 1, score: shixun_questions.map(&:question_score).min,
num: shixun_questions.count)
end
end
end

@ -0,0 +1,12 @@
class AddExerciseLevelSettingToQuestion < ActiveRecord::Migration
def change
add_column :exercise_questions, :exercise_level_setting_id, :integer, default: 0
add_column :exercise_questions, :level, :integer, default: 1
add_index :exercise_questions, :exercise_level_setting_id
ExerciseQuestion.where(question_type: 5).find_each do |question|
question.update_attributes(exercise_level_setting_id: question.exercise.exercise_level_settings.first.try(:id)) if question.exercise.present?
end
end
end

@ -0,0 +1,13 @@
class CreateQuestionCount < ActiveRecord::Migration
def up
add_column :exercise_level_settings, :exercise_questions_count, :integer, :default => 0
ExerciseLevelSetting.reset_column_information
ExerciseLevelSetting.find_each do |s|
ExerciseLevelSetting.reset_counters s.id, :exercise_questions
end
end
def down
end
end

@ -0,0 +1,14 @@
class CreateExerciseUserQuestions < ActiveRecord::Migration
def change
create_table :exercise_user_questions do |t|
t.references :exercise
t.references :exercise_user
t.references :exercise_question
t.timestamps
end
add_index :exercise_user_questions, :exercise_id
add_index :exercise_user_questions, :exercise_user_id
add_index :exercise_user_questions, :exercise_question_id
end
end

File diff suppressed because one or more lines are too long

@ -1717,10 +1717,9 @@ function copy_course(url){
}
function new_shixun_exercise(id){
if($("input[name='shixun_exercise']:checked").length == 0){
if($("input[name='shixun_exercise[]']:checked").length == 0){
$("#exercise_type_notice").show();
} else{
var type=$("input[name='shixun_exercise']:checked").val();
$("#shixun_exercise_question").submit();
hideModal();
}

@ -2974,15 +2974,18 @@ a.singlepublishtwo{
.edu-cooperation li{height: 60px;width: 210px;padding: 10px 0px;margin-left: 20px;float: left;margin-bottom: 20px;text-align: center;line-height: 40px;box-sizing: border-box}
.edu-cooperation li img{height: 40px;width: 210px;}
/*单位-合作伙伴*/
.addOperation{width: 100%;display: block;height: 56px;line-height: 56px;text-align: center;border-bottom: 1px solid #eee;}
.partnerList li a{
display: block;height: 40px;line-height: 40px;padding:0px 10px;width: 100%;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;
.addOperation{width: 100%;display: block;height: 56px;line-height: 56px;text-align: center;border-bottom: 1px solid #eee;background: #fff}
.partnerList>li{
background: #fff;
}
.partnerList>li>a{
display: block;height: 40px;line-height: 40px;padding:0px 10px;width: 87%;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;
box-sizing: border-box;position: relative;
}
.partnerList li a.active:after{
.partnerList>li>a.active:after{
position: absolute;left: 0px;height: 100%;width: 2px;content: '';background: #4cacff;
}
.partnerList{max-height: 500px;overflow-y: auto;}
/*.partnerList{max-height: 500px;overflow-y: auto;}*/
.manageList{float: left}
.manageList li{width: 60px;float: left;margin-right: 15px;border-radius: 50%;text-align: center;position: relative;margin-bottom: 10px;}
.manageList li>a.addManage,.manageList li>img{width: 60px;height: 60px;line-height: 49px;margin-right: 10px;border-radius: 50%;display: block}

@ -149,7 +149,8 @@ a.decoration{text-decoration: underline}
.padding20-15{padding: 20px 15px;box-sizing: border-box}
.padding20-10{padding: 20px 10px;box-sizing: border-box}
.padding20-25{padding: 20px 25px;box-sizing: border-box}
.padding10{padding: 10px;box-sizing: border-box}
.padding20{padding: 20px;box-sizing: border-box}
.padding30{padding: 30px;box-sizing: border-box}
.padding30-20{padding: 30px 20px;box-sizing: border-box}
.padding30-40{padding: 30px 40px;box-sizing: border-box}
@ -229,6 +230,8 @@ input::-ms-clear{display:none;}
.color-grey-B4{color: #B4B4B4!important;}
.color-grey-74{color: #747A7F!important;}
.color-f5f5f5{color: #f5f5f5!important;}
.color-afafaf{color: #afafaf!important;}
a.color-grey-name:hover,a.color-dark:hover,a.color-grey-6:hover,a.color-grey-3:hover{color: #4cacff!important;}
a.color-grey-9:hover,a.color-grey-8:hover,a.color-grey-c:hover{color: #111C24!important;}
/*蓝色*/
@ -883,3 +886,137 @@ html>body #ajax-indicator { position: fixed; }
margin-top: 60px;
margin-left: -26px;
}
.selecshixun{
overflow-y: scroll;
}
.practicalTemp{
width:1200px;
min-height:950px;
background:rgba(255,255,255,1);
border:1px solid rgba(238,238,238,1);
}
.practicalTitlefont{
font-size:18px;
font-family:MicrosoftYaHei;
font-weight:400;
color:rgba(102,102,102,1);
width: 1200px;
min-height: 60px;
line-height: 25px;
padding-left: 10px;
border-bottom: 1px solid rgba(238,238,238,1);
}
.practicalTitle{
width: 1160px;
padding: 20px;
border-bottom:1px solid rgba(238,238,238,1);
}
.Titlefont{
width: 48px;
min-height: 30px;
font-size: 15px;
font-family: MicrosoftYaHei;
font-weight: 400;
color: rgba(5,16,26,1);
}
.shixun-title-font{
font-size:16px;
font-family:MicrosoftYaHei;
font-weight:400;
color:#828282;
}
.colorFF8121{
color: #FF8121;
font-size: 12px;
text-align: left;
width: 110px;
margin-left: 117px;
}
.colorFF8121sum{
color: #FF8121;
font-size: 12px;
text-align: left;
width: 160px;
margin-left: 62px;
}
.borderFF8121{
border:1px solid #FF8121
}
.shixunsbox{
width: 1180px;
padding-left: 20px;
padding-bottom: 20px;
border-bottom: 1px solid rgba(238,238,238,1);
}
.shixunsboxs{
width: 1180px;
padding-left: 20px;
padding-bottom: 20px;
}
.shixunsboxfont{
width:1060px;
min-height:12px;
font-size:4px;
font-family:MicrosoftYaHei;
font-weight:400;
color:rgba(122,122,122,1);
display: inline-block;
}
.shixundelect{
font-size: 18px;
}
.shixundelect:hover .color-afafaf{
color:#5b5b5b !important;
}
.block{
display: block;
}
.over300{
max-height: 300px;
overflow-y: auto;
display: block;
}
.width100p{
width:100px;
}
.width425p{
width:425px;
}
.width420p{
width:420px;
}
.newshixunbox{
width: 303px;
height: 40px;
background: rgba(255,255,255,1);
border: 1px solid rgba(255,104,0,1);
border-radius: 2px;
line-height: 40px;
margin: 0 auto;
margin-top: 20px;
}
.newshixunboxfont{
width:71px;
height:12px;
font-size:4px;
font-family:MicrosoftYaHei;
font-weight:400;
color:rgba(255,104,0,1);
margin: 0 auto;
}

@ -0,0 +1,8 @@
FactoryGirl.define do
factory :exercise_level_setting do
exercise nil
level 1
score 1
num 1
end
end

@ -0,0 +1,7 @@
FactoryGirl.define do
factory :exercise_user_question do
exercise nil
exercise_user nil
exercise_question nil
end
end

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe ExerciseLevelSetting, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe ExerciseUserQuestion, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save