实训作业
This commit is contained in:
parent
725697392e
commit
5508cedb45
|
|
@ -92,7 +92,7 @@ class HomeworkCommonController < ApplicationController
|
|||
@homework = HomeworkCommon.new
|
||||
@shixuns = Shixun.where(:status => 2).where("name like ?", "%#{search}%")
|
||||
@shixuns_count = @shixuns.count
|
||||
@limit = 2
|
||||
@limit = 8
|
||||
@is_remote = true
|
||||
@shixun_pages = Paginator.new @shixuns_count, @limit, params['page'] || 1
|
||||
@offset ||= @shixun_pages.offset
|
||||
|
|
|
|||
|
|
@ -244,6 +244,7 @@ class ManagementsController < ApplicationController
|
|||
else
|
||||
shixun.update_column('status', 2)
|
||||
apply_action.update_attributes(:status => 1, :dealer_id => User.current.id)
|
||||
shixun_modify_status_without_publish shixun, 1
|
||||
end
|
||||
@authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => 0)
|
||||
respond_to do |format|
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class StudentWorkController < ApplicationController
|
|||
require "base64"
|
||||
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,
|
||||
:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,
|
||||
:search_course_students,:work_canrepeat,:add_group_member,:change_project]
|
||||
:search_course_students,:work_canrepeat,:add_group_member,:change_project,:relate_myshixun]
|
||||
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work, :retry_work, :revise_attachment, :hide_score_detail, :destroy_score]
|
||||
before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work]
|
||||
before_filter :author_of_work, :only => [:edit, :update, :destroy]
|
||||
|
|
@ -563,7 +563,7 @@ class StudentWorkController < ApplicationController
|
|||
student_work.user_id = User.current.id
|
||||
student_work.commit_time = Time.now
|
||||
#student_work.late_reason = params[:late_reason] if params[:late_reason]
|
||||
student_work.group_id = @homework.student_works.all_commit.select("distinct group_id").count + 1
|
||||
student_work.group_id = @homework.homework_type == 3 ? @homework.student_works.all_commit.select("distinct group_id").count + 1 : 0
|
||||
student_work.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(student_work)
|
||||
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
|
||||
|
|
@ -728,10 +728,13 @@ class StudentWorkController < ApplicationController
|
|||
ids = ids - [User.current.id]
|
||||
end
|
||||
@team_work = User.where(:id => ids)
|
||||
elsif @homework.homework_type == 4
|
||||
@shixun = @homework.homework_commons_shixuns.shixun
|
||||
@myshixun = Myshixun.find @work.myshixun_id
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_edu'}
|
||||
format.js
|
||||
format.html{render :layout => 'base_edu'}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -874,6 +877,48 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def relate_myshixun
|
||||
myshixun = Myshixun.where(:shixun_id => @homework.homework_commons_shixuns.shixun_id, :user_id => User.current.id).first
|
||||
if myshixun
|
||||
work = @homework.student_works.where(:user_id => User.current.id).first
|
||||
work = work || StudentWork.new(:homework_common_id => @homework.id, :user_id => User.current.id, :work_status => 0)
|
||||
if work.work_status == 0
|
||||
work.myshixun_id = myshixun.id
|
||||
work.commit_time = Time.now
|
||||
if @homework.end_time < Time.now
|
||||
work.late_penalty = @homework.late_penalty
|
||||
work.work_status = 2
|
||||
|
||||
#更新CourseHomeworkStatistics中学生的迟交作品数
|
||||
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, User.current.id)
|
||||
course_statistics.update_attribute('late_commit_work_num', course_statistics.late_commit_work_num + 1) if course_statistics
|
||||
else
|
||||
work.late_penalty = 0
|
||||
work.work_status = 1
|
||||
end
|
||||
if work.save
|
||||
#更新CourseHomeworkStatistics中学生的未交作品数、已交作品数
|
||||
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, User.current.id)
|
||||
course_statistics.update_attribute('committed_work_num', course_statistics.committed_work_num + 1) if course_statistics
|
||||
course_statistics.update_attribute('un_commit_work_num', (course_statistics.un_commit_work_num - 1) < 0 ? 0 : (course_statistics.un_commit_work_num - 1)) if course_statistics
|
||||
|
||||
@homework.update_column(:updated_at, Time.now)
|
||||
update_course_activity(@homework.class,@homework.id)
|
||||
update_user_activity(@homework.class,@homework.id)
|
||||
update_org_activity(@homework.class,@homework.id)
|
||||
|
||||
course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"new",:course_message_id=>work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录
|
||||
course_message.save
|
||||
@status = 1
|
||||
end
|
||||
else
|
||||
@status = 2
|
||||
end
|
||||
else
|
||||
@status = 0
|
||||
end
|
||||
end
|
||||
|
||||
#添加评分,已评分则为修改评分
|
||||
def add_score
|
||||
@is_last = params[:is_last] == "true"
|
||||
|
|
|
|||
|
|
@ -181,8 +181,8 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
# 已通过的关卡数
|
||||
def had_passed_changllenge_count shixun
|
||||
myshixun = Myshixun.where(:shixun_id => shixun.id, :user_id => User.current.id).first
|
||||
def had_passed_changllenge_count shixun, user
|
||||
myshixun = Myshixun.where(:shixun_id => shixun.id, :user_id => user.id).first
|
||||
if myshixun.nil?
|
||||
0
|
||||
else
|
||||
|
|
|
|||
|
|
@ -98,29 +98,42 @@ module StudentWorkHelper
|
|||
work = cur_user_works_for_homework homework
|
||||
project = cur_user_projects_for_homework homework
|
||||
if work.nil? && homework.end_time >= Time.now
|
||||
link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr'
|
||||
if homework.homework_type == 4
|
||||
link_to "关联实训", relate_myshixun_student_work_index_path(:homework => homework.id),:class => 'task-btn task-btn-blue fr',:remote => true
|
||||
else
|
||||
link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr'
|
||||
end
|
||||
elsif work.nil? && homework.end_time < Time.now
|
||||
if homework.allow_late && homework.homework_detail_manual.comment_status < 6
|
||||
link_to "补交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr'
|
||||
if homework.homework_type == 4
|
||||
link_to "关联实训", relate_myshixun_student_work_index_path(:homework => homework.id),:class => 'task-btn task-btn-blue fr',:remote => true
|
||||
else
|
||||
link_to "补交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr'
|
||||
end
|
||||
end
|
||||
elsif work
|
||||
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 #匿评作业,且作业状态不是在开启匿评之前
|
||||
if homework.homework_type != 3
|
||||
link_to "匿评作品", student_work_index_url_in_org(homework.id, 2), :class => 'task-btn task-btn-blue fr', :title => "开启匿评后不可修改作品"
|
||||
else
|
||||
work_ids = "(" + homework.student_works.has_committed.map(&:id).join(",") + ")"
|
||||
if User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0
|
||||
if homework.homework_type == 4
|
||||
myshixun = Myshixun.find work.myshixun_id
|
||||
link_to "继续实训", myshixun_game_path(myshixun.current_task, :myshixun_id => myshixun), :class => "task-btn task-btn-blue fr mr10",:target => "_blank" if myshixun
|
||||
else
|
||||
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 #匿评作业,且作业状态不是在开启匿评之前
|
||||
if homework.homework_type != 3
|
||||
link_to "匿评作品", student_work_index_url_in_org(homework.id, 2), :class => 'task-btn task-btn-blue fr', :title => "开启匿评后不可修改作品"
|
||||
else
|
||||
link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr', :title => "匿评开启后提交的作品不参与匿评"
|
||||
work_ids = "(" + homework.student_works.has_committed.map(&:id).join(",") + ")"
|
||||
if User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0
|
||||
link_to "匿评作品", student_work_index_url_in_org(homework.id, 2), :class => 'task-btn task-btn-blue fr', :title => "开启匿评后不可修改作品"
|
||||
else
|
||||
link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr', :title => "匿评开启后提交的作品不参与匿评"
|
||||
end
|
||||
end
|
||||
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status > 3
|
||||
link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr', :title => "匿评已结束"
|
||||
elsif homework.end_time >= Time.now && work.user_id == User.current.id
|
||||
link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'task-btn task-btn-blue fr'
|
||||
else
|
||||
link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr', :title => "作业截止后不可修改作品"
|
||||
end
|
||||
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status > 3
|
||||
link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr', :title => "匿评已结束"
|
||||
elsif homework.end_time >= Time.now && work.user_id == User.current.id
|
||||
link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'task-btn task-btn-blue fr'
|
||||
else
|
||||
link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr', :title => "作业截止后不可修改作品"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class Myshixun < ActiveRecord::Base
|
|||
has_many :games, :dependent => :destroy, :order => "games.id ASC"
|
||||
belongs_to :shixun
|
||||
has_one :shixun_modify, :dependent => :destroy
|
||||
has_many :student_works
|
||||
|
||||
def total_stage
|
||||
self.games.count
|
||||
|
|
@ -18,6 +19,34 @@ class Myshixun < ActiveRecord::Base
|
|||
return position
|
||||
end
|
||||
|
||||
def done_time
|
||||
time = ""
|
||||
if self.status == 1
|
||||
time = self.games.order("end_time desc").first.try(:end_time)
|
||||
end
|
||||
time
|
||||
end
|
||||
|
||||
def total_spend_time
|
||||
time = 0
|
||||
self.games.each do |game|
|
||||
if game.status == 2
|
||||
time += (game.end_time -game.open_time).to_i > 0 ? (game.end_time -game.open_time).to_i : 0
|
||||
end
|
||||
end
|
||||
time
|
||||
end
|
||||
|
||||
def total_score
|
||||
score = 0
|
||||
self.games.each do |game|
|
||||
if game.status == 2
|
||||
score += game.final_score
|
||||
end
|
||||
end
|
||||
score
|
||||
end
|
||||
|
||||
# id 转换成 identifier
|
||||
def to_param
|
||||
identifier
|
||||
|
|
|
|||
|
|
@ -54,6 +54,14 @@ class Shixun < ActiveRecord::Base
|
|||
render_404
|
||||
end
|
||||
|
||||
def shixun_score
|
||||
score = 0
|
||||
self.challenges.each do |challenge|
|
||||
score += challenge.score
|
||||
end
|
||||
score
|
||||
end
|
||||
|
||||
def collaborators
|
||||
self.shixun_members.select{|member| member.role == 2} unless self.shixun_members.blank?
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class StudentWork < ActiveRecord::Base
|
|||
# course's message
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
has_many :attachments, :dependent => :destroy
|
||||
has_one :myshixun
|
||||
|
||||
scope :has_committed, lambda{where("work_status != 0 and work_status != 3")}
|
||||
scope :all_commit, lambda{where("work_status != 0")}
|
||||
|
|
|
|||
|
|
@ -72,16 +72,16 @@
|
|||
</li>
|
||||
<% end %>
|
||||
<% if (User.current.teacher_of_course(homework_common.course) || homework_common.user == User.current) && User.current.homework_banks.where(:homework_common_id => homework_common.id).empty? %>
|
||||
<li id="add_to_homework_bank_<%= homework_common.id %>">
|
||||
<li class="add_to_homework_bank_<%= homework_common.id %>">
|
||||
<%= link_to "加入题库", add_to_homework_bank_homework_common_path(homework_common, :type => 1), :remote => true %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if homework_common.user == User.current %>
|
||||
<% if homework_common.is_update && !User.current.homework_banks.where(:homework_common_id => homework_common.id).blank? %>
|
||||
<li id="add_to_homework_bank_<%= homework_common.id %>">
|
||||
<li class="add_to_homework_bank_<%= homework_common.id %>">
|
||||
<%= link_to "同步到题库", add_to_homework_bank_homework_common_path(homework_common, :type => 2), :remote => true %>
|
||||
</li>
|
||||
<li id="add_to_homework_bank_<%= homework_common.id %>">
|
||||
<li class="add_to_homework_bank_<%= homework_common.id %>">
|
||||
<%= link_to "另存到题库", add_to_homework_bank_homework_common_path(homework_common, :type => 3), :remote => true %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ var str = "";
|
|||
str = "已经另存到题库";
|
||||
<% end %>
|
||||
notice_sure_box(str);
|
||||
$("#add_to_homework_bank_<%= @homework.id %>").remove();
|
||||
$(".add_to_homework_bank_<%= @homework.id %>").remove();
|
||||
|
|
@ -15,10 +15,10 @@
|
|||
<td class="<%= score_color (!score_open || student_work.teacher_score.nil? ? nil : student_work.teacher_score)%>">
|
||||
<%= student_work.teacher_score.nil? ? "--" : (!score_open ? "**" : format("%.1f",student_work.teacher_score))%>
|
||||
</td>
|
||||
<td class="<%= score_color (!score_open || student_work.teaching_asistant_score.nil? ? nil : student_work.teaching_asistant_score)%>">
|
||||
<td class="<%= score_color (!score_open || student_work.teaching_asistant_score.nil? ? nil : student_work.teaching_asistant_score)%> pr student_score_info">
|
||||
<%= student_work.teaching_asistant_score.nil? ? "--" : (!score_open ? "**" : format("%.1f",student_work.teaching_asistant_score))%>
|
||||
<% if !student_work.teaching_asistant_score.nil? && score_open %>
|
||||
<div class="popup_tip_box-black">
|
||||
<div class="popup_tip_box-black" style="left: 330px;">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p><%= student_work.student_works_scores.where(:reviewer_role => 2).group_by(&:user_id).count%>名助教进行了评分<br/><%= ta_score_mode(@homework) %>分:<%= student_work.teaching_asistant_score %> 分
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
<% end %>
|
||||
</td>
|
||||
<% if @homework.anonymous_comment == 0 %>
|
||||
<td class="<%= score_color (!score_open || student_work.student_score.nil? ? nil : student_work.student_score)%>">
|
||||
<td class="<%= score_color (!score_open || student_work.student_score.nil? ? nil : student_work.student_score)%> pr student_score_info">
|
||||
<% if student_work.student_score.nil? %>
|
||||
<% if student_work.work_status != 0 %>
|
||||
<% if @homework.homework_detail_manual.comment_status >= 3 && student_work.student_works_evaluation_distributions.count == 0 %>
|
||||
|
|
@ -63,10 +63,10 @@
|
|||
<% end %>
|
||||
<!-- 成绩 -->
|
||||
<% score = student_work.work_score %>
|
||||
<td class="<%= score_color (!score_open || score.nil? ? nil : score)%>">
|
||||
<td class="<%= score_color (!score_open || score.nil? ? nil : score)%> pr student_score_info">
|
||||
<%= score.nil? ? "--" : (!score_open ? "**" : format("%.1f",score<0 ? 0 : score))%>
|
||||
<% unless !score_open || score.nil?%>
|
||||
<div class="popup_tip_box-black " style="left:160px;" >
|
||||
<div class="popup_tip_box-black" style="left:160px;" >
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p><%= student_work.user.show_name %>(<%= student_work.user.login %>)<br/>
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@
|
|||
<td class="<%= score_color (!score_open || student_work.teacher_score.nil? ? nil : student_work.teacher_score)%>">
|
||||
<%= student_work.teacher_score.nil? ? "--" : (!score_open ? "**" : format("%.1f",student_work.teacher_score))%>
|
||||
</td>
|
||||
<td class="<%= score_color (!score_open || student_work.teaching_asistant_score.nil? ? nil : student_work.teaching_asistant_score)%>">
|
||||
<td class="<%= score_color (!score_open || student_work.teaching_asistant_score.nil? ? nil : student_work.teaching_asistant_score)%> student_score_info pr">
|
||||
<%= student_work.teaching_asistant_score.nil? ? "--" : (!score_open ? "**" : format("%.1f",student_work.teaching_asistant_score))%>
|
||||
<% if !student_work.teaching_asistant_score.nil? && score_open %>
|
||||
<div class="popup_tip_box-black">
|
||||
<div class="popup_tip_box-black" style="left: 330px;">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p><%= student_work.student_works_scores.where(:reviewer_role => 2).group_by(&:user_id).count%>名助教进行了评分<br/><%= ta_score_mode(@homework) %>分:<%= student_work.teaching_asistant_score %> 分
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
<% end %>
|
||||
</td>
|
||||
<% if @homework.anonymous_comment == 0 %>
|
||||
<td class="<%= score_color (!score_open || student_work.student_score.nil? ? nil : student_work.student_score)%>">
|
||||
<td class="<%= score_color (!score_open || student_work.student_score.nil? ? nil : student_work.student_score)%> student_score_info pr">
|
||||
<% if student_work.student_score.nil? %>
|
||||
<% if student_work.work_status != 0 %>
|
||||
<% if @homework.homework_detail_manual.comment_status >= 3 && student_work.student_works_evaluation_distributions.count == 0 %>
|
||||
|
|
@ -66,10 +66,10 @@
|
|||
<% end %>
|
||||
<!-- 成绩 -->
|
||||
<% score = student_work.work_score %>
|
||||
<td class="<%= score_color (!score_open || score.nil? ? nil : score)%>">
|
||||
<td class="<%= score_color (!score_open || score.nil? ? nil : score)%> student_score_info pr">
|
||||
<%= score.nil? ? "--" : (!score_open ? "**" : format("%.1f",score<0 ? 0 : score))%>
|
||||
<% unless !score_open || score.nil?%>
|
||||
<div class="popup_tip_box-black " style="left:160px;" >
|
||||
<div class="popup_tip_box-black" style="left:140px;" >
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p><%= student_work.user.show_name %>(<%= student_work.user.login %>)<br/>
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@
|
|||
<td class="<%= score_color (!score_open || student_work.teacher_score.nil? ? nil : student_work.teacher_score)%>">
|
||||
<%= student_work.teacher_score.nil? ? "--" : (!score_open ? "**" : format("%.1f",student_work.teacher_score))%>
|
||||
</td>
|
||||
<td class="<%= score_color (!score_open || student_work.teaching_asistant_score.nil? ? nil : student_work.teaching_asistant_score)%>">
|
||||
<td class="<%= score_color (!score_open || student_work.teaching_asistant_score.nil? ? nil : student_work.teaching_asistant_score)%> student_score_info pr">
|
||||
<%= student_work.teaching_asistant_score.nil? ? "--" : (!score_open ? "**" : format("%.1f",student_work.teaching_asistant_score))%>
|
||||
<% if !student_work.teaching_asistant_score.nil? && score_open %>
|
||||
<div class="popup_tip_box-black">
|
||||
<div class="popup_tip_box-black" style="left: 330px;">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p><%= student_work.student_works_scores.where(:reviewer_role => 2).group_by(&:user_id).count%>名助教进行了评分<br/><%= ta_score_mode(@homework) %>分:<%= student_work.teaching_asistant_score %> 分
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
<%= student_work.system_score.nil? ? "--" : (!score_open ? "**" : format("%.1f",student_work.system_score))%>
|
||||
</td>
|
||||
<% if @homework.anonymous_comment == 0 %>
|
||||
<td class="<%= score_color (!score_open || student_work.student_score.nil? ? nil : student_work.student_score)%>">
|
||||
<td class="<%= score_color (!score_open || student_work.student_score.nil? ? nil : student_work.student_score)%> student_score_info pr">
|
||||
<% if student_work.student_score.nil? %>
|
||||
<% if student_work.work_status != 0 %>
|
||||
<% if @homework.homework_detail_manual.comment_status >= 3 && student_work.student_works_evaluation_distributions.count == 0 %>
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
<% end %>
|
||||
<!-- 成绩 -->
|
||||
<% score = student_work.work_score %>
|
||||
<td class="<%= score_color (!score_open || score.nil? ? nil : score)%>">
|
||||
<td class="<%= score_color (!score_open || score.nil? ? nil : score)%> student_score_info pr">
|
||||
<%= score.nil? ? "--" : (!score_open ? "**" : format("%.1f",score<0 ? 0 : score))%>
|
||||
<% unless !score_open || score.nil?%>
|
||||
<div class="popup_tip_box-black " style="left:160px;" >
|
||||
|
|
|
|||
|
|
@ -11,9 +11,10 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% shixun = @homework.homework_commons_shixuns.shixun %>
|
||||
<% @stundet_works.each_with_index do |student_work, i| %>
|
||||
<% score_open = @is_teacher || @homework.score_open == 1 || student_work.user == User.current %>
|
||||
<a name="<%= student_work.id%>"></a>
|
||||
<%= render :partial => "evaluation_un_shixun_work", :locals => {:student_work => student_work, :index => i, :score_open => score_open} %>
|
||||
<%= render :partial => "evaluation_un_shixun_work", :locals => {:student_work => student_work, :index => i, :score_open => score_open, :shixun => shixun} %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
|
@ -12,7 +12,16 @@
|
|||
<td>
|
||||
<%= student_work.work_status == 0 ? '--' : format_time(student_work.updated_at) %>
|
||||
</td>
|
||||
<td>
|
||||
<td class="pr student_score_info">
|
||||
<%= student_work.work_status == 0 ? '--' : had_passed_changllenge_count(shixun, student_work.user).to_s+"/"+shixun.challenges.count.to_s %>
|
||||
<% if student_work.work_status != 0 %>
|
||||
<div class="popup_tip_box-black" style="left: 288px;">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p>已通过<%= had_passed_changllenge_count(shixun, student_work.user) %>关,共<%= shixun.challenges.count %>关
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
<!-- 成绩 -->
|
||||
<% score = student_work.work_score %>
|
||||
|
|
@ -20,6 +29,10 @@
|
|||
<%= score.nil? ? "--" : (!score_open ? "**" : format("%.1f",score<0 ? 0 : score))%>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to '查看', student_work_path(student_work) %>
|
||||
<% if student_work.work_status != 0 %>
|
||||
<%= link_to '查看', student_work_path(student_work), :remote => true %>
|
||||
<% else %>
|
||||
--
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<div class="task-popup" style="width:600px;">
|
||||
<div class="task-popup-title clearfix ">
|
||||
<h3 class="fl">学员实训信息</h3>
|
||||
<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
|
||||
</div>
|
||||
<div class="task_popup_con">
|
||||
<div class="clearfix mb10 edu-class-con-list">
|
||||
<p class="fl">
|
||||
<%= link_to @shixun.owner.try(:show_name), user_path(@shixun.owner), :class => "link-name-dark fl", :target => "_blank" %>
|
||||
<span class="fl mr5 ml5">/</span>
|
||||
<%= link_to @shixun.name, shixun_path(@shixun), :class => "edu-info-dark fl", :target => "_blank" %>
|
||||
</p>
|
||||
<span class="edu-cir-grey fr mt5" style="padding:5px; background:#ddd;">经验值:<%= @myshixun.total_score %> </span>
|
||||
</div>
|
||||
<div class="clearfix mb20 color-grey">
|
||||
<%= link_to image_tag(url_to_avatar(@work.user), :width =>"50", :height => "50", :alt=>"头像", :style => "width:50px; height:50px;"), user_path(@work.user), :class => "fl edu-work-user-img", :target => "_blank" %>
|
||||
<ul class="fl edu-txt-w240 ml15">
|
||||
<li class="clearfix">
|
||||
<%= link_to @work.user.try(:show_name), user_path(@work.user), :class => "edu-txt-w140 task-hide fl", :target => "_blank" %>
|
||||
<!--<span class="color-orange ml10 fl">No.588</span>-->
|
||||
</li>
|
||||
<li>通关时间: <%= @myshixun.try(:status) == 1 ? (format_time @myshixun.done_time) : '- -' %></li>
|
||||
</ul>
|
||||
<ul class="fl edu-txt-w240">
|
||||
<li>通关情况:<%= had_passed_changllenge_count(@shixun, @work.user).to_s+" / "+@shixun.challenges.count.to_s %></li>
|
||||
<li>总耗时:<%=had_passed_changllenge_count(@shixun, @work.user) > 0 ? game_spend_time(total_spend_time @myshixun) : '- -' %></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="edu-h200-auto" style="max-height:250px;">
|
||||
<table class="edu-pop-table color-grey edu-txt-center table-pa5 font-12" cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<!--<th>排名</th>-->
|
||||
<th>耗时</th>
|
||||
<th>经验值</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @myshixun.games.each_with_index do |game, index| %>
|
||||
<tr>
|
||||
<td>第<%= index + 1 %>关</td>
|
||||
<!--<td>No.255</td>-->
|
||||
<td><%= game.status == 2 ? game_spend_time((game.end_time - game.open_time).to_i) : '- -' %></td>
|
||||
<td><%= game.status == 2 ? game.final_score : '- -' %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -75,16 +75,16 @@
|
|||
</li>
|
||||
<% end %>
|
||||
<% if (User.current.teacher_of_course(@homework.course) || @homework.user == User.current) && User.current.homework_banks.where(:homework_common_id => @homework.id).empty? %>
|
||||
<li id="add_to_homework_bank_<%= @homework.id %>">
|
||||
<li class="add_to_homework_bank_<%= @homework.id %>">
|
||||
<%= link_to "加入题库", add_to_homework_bank_homework_common_path(@homework, :type => 1), :remote => true %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if @homework.user == User.current %>
|
||||
<% if @homework.is_update && !User.current.homework_banks.where(:homework_common_id => @homework.id).blank? %>
|
||||
<li id="add_to_homework_bank_<%= @homework.id %>">
|
||||
<li class="add_to_homework_bank_<%= @homework.id %>">
|
||||
<%= link_to "同步到题库", add_to_homework_bank_homework_common_path(@homework, :type => 2), :remote => true %>
|
||||
</li>
|
||||
<li id="add_to_homework_bank_<%= @homework.id %>">
|
||||
<li class="add_to_homework_bank_<%= @homework.id %>">
|
||||
<%= link_to "另存到题库", add_to_homework_bank_homework_common_path(@homework, :type => 3), :remote => true %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
@ -96,6 +96,9 @@
|
|||
</div>
|
||||
<% else %>
|
||||
<%= user_work_status @homework %>
|
||||
<% if @homework.homework_type == 4 && !@homework.student_works.where(:user_id => User.current.id, :work_status => 0).blank? %>
|
||||
<%= link_to "开始实训", shixun_path(@homework.homework_commons_shixuns.shixun),:class => 'task-btn task-btn-blue fr mr10',:target => "_blank" %>
|
||||
<% end %>
|
||||
<%= link_to "查看设置", setting_homework_common_path(@homework), :class => 'edu-btn fr mr10' %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
|
|
@ -260,6 +263,9 @@
|
|||
<% end %>
|
||||
<% if @homework.homework_detail_manual.comment_status < 3 %>
|
||||
<%= user_work_status @homework %>
|
||||
<% if @homework.homework_type == 4 && !@homework.student_works.where(:user_id => User.current.id, :work_status => 0).blank? %>
|
||||
<%= link_to "开始实训", shixun_path(@homework.homework_commons_shixuns.shixun),:class => 'task-btn task-btn-blue fr mr10',:target => "_blank" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
<% if @status == 0 %>
|
||||
notice_box("您还没有开启实训,无法关联");
|
||||
<% elsif @status == 1 %>
|
||||
notice_box_redirect("<%= student_work_index_path(:homework => @homework.id) %>", "已关联成功");
|
||||
<% elsif @status == 2 %>
|
||||
notice_box_redirect("<%= student_work_index_path(:homework => @homework.id) %>", "您已关联过实训,请不要重复关联");
|
||||
<% end %>
|
||||
|
|
@ -1,37 +1,2 @@
|
|||
if($("#about_hwork_<%= @work.id%>").children().length > 0){
|
||||
$("#about_hwork_<%= @work.id%>").html("");
|
||||
}
|
||||
else{
|
||||
$(".about_hwork").html("");
|
||||
<% if @homework.homework_type == 2%>
|
||||
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
|
||||
|
||||
var program_name = "text/x-csrc";
|
||||
var language = <%= @homework.language %>;
|
||||
if (language == 1) {
|
||||
program_name = 'text/x-csrc';
|
||||
} else if(language==2){
|
||||
program_name = 'text/x-c++src';
|
||||
}else if(language==3){
|
||||
program_name = 'text/x-cython';
|
||||
} else if(language==4){
|
||||
program_name = 'text/x-java';
|
||||
}
|
||||
|
||||
var editor = CodeMirror(document.getElementById("work-code_<%= @work.id%>"), {
|
||||
mode: {name: program_name,
|
||||
version: 2,
|
||||
singleLineStringErrors: false},
|
||||
lineNumbers: true,
|
||||
indentUnit: 2,
|
||||
matchBrackets: true,
|
||||
readOnly: true,
|
||||
value: $("#work-src_<%= @work.id%>").text()
|
||||
}
|
||||
);
|
||||
|
||||
<% else%>
|
||||
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
|
||||
<% end%>
|
||||
$('#score_<%= @work.id%>').peSlider({range: 'min'});
|
||||
}
|
||||
var htmlvalue = "<%= j(render :partial => 'student_work/shixun_work_show') %>"
|
||||
pop_box_new(htmlvalue, 600, 500)
|
||||
|
|
@ -113,16 +113,16 @@
|
|||
</li>
|
||||
<% end %>
|
||||
<% if (User.current.teacher_of_course(activity.course) || activity.user == User.current) && User.current.homework_banks.where(:homework_common_id => activity.id).blank? %>
|
||||
<li id="add_to_homework_bank_<%= activity.id %>">
|
||||
<li class="add_to_homework_bank_<%= activity.id %>">
|
||||
<%= link_to "加入题库", add_to_homework_bank_homework_common_path(activity, :type => 1), :class => "wpostOptionLink", :remote => true %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if activity.user == User.current %>
|
||||
<% if activity.is_update && !User.current.homework_banks.where(:homework_common_id => activity.id).blank? %>
|
||||
<li id="add_to_homework_bank_<%= activity.id %>">
|
||||
<li class="add_to_homework_bank_<%= activity.id %>">
|
||||
<%= link_to "同步到题库", add_to_homework_bank_homework_common_path(activity, :type => 2), :class => "wpostOptionLink", :remote => true %>
|
||||
</li>
|
||||
<li id="add_to_homework_bank_<%= activity.id %>">
|
||||
<li class="add_to_homework_bank_<%= activity.id %>">
|
||||
<%= link_to "另存到题库", add_to_homework_bank_homework_common_path(activity, :type => 3), :class => "wpostOptionLink", :remote => true %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<% @shixuns.each do |shixun| %>
|
||||
<p class="clearfix pl10">
|
||||
<a href="<%= shixun_path(shixun) %>" target="_blank" class="font-16 first"><i class="fa fa-circle-o color-orange02 font-12 ml5 mr5" aria-hidden="true"></i><%= shixun.name %></a>
|
||||
<span class="font-14 hasmargin"><a href="javascript:void(0);" target="_blank">已解锁第<i><%= had_passed_changllenge_count(shixun) %></i>关/共<i><%= shixun.challenges.count %></i>关</a></span>
|
||||
<span class="font-14 hasmargin"><a href="javascript:void(0);" target="_blank">已解锁第<i><%= had_passed_changllenge_count(shixun, User.current) %></i>关/共<i><%= shixun.challenges.count %></i>关</a></span>
|
||||
<span class="font-14 fr mr25 color-grey"><%= format_time shixun.created_at %></span>
|
||||
<span class="font-14 last cl" style="display: none;">分享 <i class="fa fa-weixin font-14 blue" aria-hidden="true"></i></span>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<p class="color-grey font-12">
|
||||
<span class=""><%= (User.find shixun.user_id).show_name %></span>
|
||||
<span class="ml30"><%= shixun.language %></span>
|
||||
<span class="ml30"><%= had_passed_changllenge_count shixun %> / <%= shixun.challenges.count %> 任务完成 </span>
|
||||
<span class="ml30"><%= had_passed_changllenge_count shixun, User.current %> / <%= shixun.challenges.count %> 任务完成 </span>
|
||||
<!--<span class=" ml30">No.501 排名 </span>-->
|
||||
<span class=" ml30"><%= format_time(shixun.updated_at) %> 开启 </span>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -494,6 +494,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'alert_appeal_box'
|
||||
get 'delete_score_comment'
|
||||
get 'deal_appeal_score'
|
||||
get 'relate_myshixun'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
class AddAttachmentToCourseModule < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :course_modules, :attachment, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
class ChangeNewsForCourseModule < ActiveRecord::Migration
|
||||
def up
|
||||
rename_column :course_modules, :news, :boards
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
class DelCourseModules < ActiveRecord::Migration
|
||||
def up
|
||||
drop_table :course_modules
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddMyshixunToStudentWork < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :student_works, :myshixun_id, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -493,4 +493,14 @@ $.fn.peSlider = function(settings){
|
|||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
$(function() {
|
||||
//匿评评分提示
|
||||
$(".student_score_info").live("mouseover", function () {
|
||||
$(this).find("div").show();
|
||||
});
|
||||
$(".student_score_info").live("mouseout", function () {
|
||||
$(this).find("div").hide();
|
||||
});
|
||||
});
|
||||
|
|
@ -87,6 +87,7 @@ table.table-pa5 th,table.table-pa5 td{ padding:0 5px;}
|
|||
.edu-class-right-box{ background:#fff; position:relative; padding-bottom:20px;}
|
||||
a.edu-class-user-img{ height: 80px;}
|
||||
.edu-class-user-img img{ width: 80px; height: 80px; border-radius:100px;}
|
||||
.edu-work-user-img img{ border-radius:100px;}
|
||||
a.edu-class-right-add{ display: block; position:absolute; bottom: 0; width: 100%; height: 40px; background-color: rgba(0, 0, 0, 0.3);color:#fff; text-align: center; line-height: 40px;}
|
||||
a:hover.edu-class-right-add{ background-color: rgba(0, 0, 0, 0.4);}
|
||||
.edu-undis{ display: none!important;}
|
||||
|
|
|
|||
Loading…
Reference in New Issue