老师、学生测验列表的调整
This commit is contained in:
parent
1ad0c1cbff
commit
3ebc3c6492
|
@ -374,12 +374,13 @@ class ExerciseController < ApplicationController
|
|||
=end
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
@all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc")
|
||||
@exercise_count = @exercise.exercise_users.where('score is not NULL').count
|
||||
if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time <= Time.now)
|
||||
@exercise_users_list = @exercise.exercise_users.where('score is not NULL')
|
||||
student_id = @course.student.blank? ? "(-1)" : "(" + @course.student.map{|student| student.student_id}.join(",") + ")"
|
||||
@exercise_count = @exercise.exercise_users.where("score is not NULL and user_id in #{student_id}").count
|
||||
if @is_teacher || (!@exercise.exercise_users.where("user_id = #{User.current.id} and user_id in #{student_id}").empty? && @exercise.end_time <= Time.now)
|
||||
@exercise_users_list = @exercise.exercise_users.where("score is not NULL and user_id in #{student_id}")
|
||||
@show_all = true;
|
||||
elsif !@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time > Time.now
|
||||
@exercise_users_list = @exercise.exercise_users.where("user_id = ? and score is not NULL",User.current.id)
|
||||
elsif !@exercise.exercise_users.where("user_id = #{User.current.id} and user_id in #{student_id}").empty? && @exercise.end_time > Time.now
|
||||
@exercise_users_list = @exercise.exercise_users.where("user_id = ? and score is not NULL and user_id in #{student_id}",User.current.id)
|
||||
else
|
||||
@exercise_users_list = []
|
||||
end
|
||||
|
@ -537,7 +538,7 @@ class ExerciseController < ApplicationController
|
|||
else
|
||||
# 更新提交状态
|
||||
cur_exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", User.current, @exercise.id).first
|
||||
cur_exercise_user.update_attributes(:status => 1)
|
||||
cur_exercise_user.update_attributes(:status => 1, :commit_status => 1)
|
||||
# 答题过程中需要统计完成量
|
||||
@uncomplete_question = get_uncomplete_question(@exercise, User.current)
|
||||
# 获取改学生的考试得分
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
class ExerciseUser < ActiveRecord::Base
|
||||
#commit_status 0:未交 1:已交
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
belongs_to :user
|
||||
|
|
|
@ -3,13 +3,8 @@
|
|||
<% if @is_teacher%>
|
||||
<div>
|
||||
<div title="<%= exercise.exercise_name %>">
|
||||
<div style="width: 310px;float: left;">
|
||||
<%# if has_commit %>
|
||||
<%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%>
|
||||
<%# else %>
|
||||
<%#= link_to poll_name, exercise_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %>
|
||||
<%# end %>
|
||||
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %>
|
||||
<div style="width: 500px;float: left;">
|
||||
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue mw450", :title => "#{exercise_name}" %>
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<span class="exercise_status_nop fl mt3"></span>
|
||||
<% elsif exercise.exercise_status == 2 %>
|
||||
|
@ -20,19 +15,9 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<%# if exercise.exercise_status == 2 %>
|
||||
<!--<li><a class="polls_de fr ml5" onclick="" href="javascript:">关闭</a></li>-->
|
||||
<%# else %>
|
||||
<!--<li class="polls_de_grey fr ml5" title="发布的问卷才能进行关闭">关闭</li>-->
|
||||
<%# end%>
|
||||
|
||||
<%# if exercise.exercise_status == 1%>
|
||||
<!--<li class="polls_de_grey fr ml5">导出</li>-->
|
||||
<%# elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %>
|
||||
<!--<li><%#= link_to "导出", export_exercise_exercise_path(exercise.id,:format => "xls"), :class => "polls_de fr ml5"%></li>-->
|
||||
<%# end%>
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<div><a href="javascript:" class="pollsbtn btn_pu fr mr10 ml5" onclick="exercise_submit(<%= exercise.id%>,<%= exercise.exercise_name.length %>,<%=index.to_i %>);">发布试卷</a></div>
|
||||
<% end_time_status = exercise.end_time.nil? ? 1 : (exercise.end_time <= Time.now ? 2 : 3) %>
|
||||
<div><a href="javascript:" class="pollsbtn btn_pu fr mr10 ml5" onclick="exercise_submit(<%=end_time_status %>,<%= exercise.id%>,<%= exercise.exercise_name.length %>,<%=index.to_i %>);">发布试卷</a></div>
|
||||
<% elsif exercise.exercise_status == 2%>
|
||||
<div><a href="javascript:" class="pollsbtn btn_de fr mr10 ml5" onclick="republish_exercise(<%= exercise.id%>,<%=index.to_i %>);">取消发布</a></div>
|
||||
<% else%>
|
||||
|
@ -51,15 +36,15 @@
|
|||
<span class="c_grey fl mr15">测试时长:<%= exercise.time.nil? || exercise.time == -1 ? '不限' : exercise.time.to_s + "分钟" %></span>
|
||||
<span class="c_grey fl mr15">截止时间:<%= exercise.end_time.nil? ? '未设置' : format_time(exercise.end_time) %></span>
|
||||
<span class="c_grey fl mr15">发布时间:<%= exercise.publish_time.nil? ? '未设置' : format_time(exercise.publish_time) %></span>
|
||||
<% if exercise.exercise_status > 2 %>
|
||||
<span class="c_grey fl mr15">已提交:<span class="c_blue"><%= exercise.exercise_users.where("created_at >= #{exercise.end_time.to_i}").count %></span></span>
|
||||
<span class="c_grey fl mr15">未提交:<span class="c_blue"><%= exercise.course.student.count - exercise.exercise_users.where("created_at >= #{exercise.end_time.to_i}").count %></span></span>
|
||||
<% if @is_teacher && exercise.exercise_status > 2 %>
|
||||
<span class="c_grey fl mr15">已提交:<span class="c_blue"><%= exercise.exercise_users.where("commit_status = 1").count %></span></span>
|
||||
<span class="c_grey fl mr15">未提交:<span class="c_blue"><%= exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count %></span></span>
|
||||
<% end %>
|
||||
|
||||
<div id="exercise_opr_<%=exercise.id %>" class="none fr">
|
||||
<a href="javascript:void(0)" onClick="delete_exercise(<%=exercise.id %>);" class="ex_icon_de mt0"></a>
|
||||
<a href="javascript:void(0)" onClick="delete_exercise(<%=exercise.id %>);" title="删除试卷" class="ex_icon_de mt0"></a>
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<%= link_to '', edit_exercise_path(exercise.id), :class => "ex_icon_edit mt0"%>
|
||||
<%= link_to '', edit_exercise_path(exercise.id), :title => "编辑试卷", :class => "ex_icon_edit mt0"%>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
|
@ -67,31 +52,50 @@
|
|||
|
||||
<% else%>
|
||||
<% if exercise.exercise_status != 1%>
|
||||
<%# if has_commit%>
|
||||
<!--li><%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue" %></li>
|
||||
<li class="pollsbtn_tip fl ml5">已答</li-->
|
||||
<%#else%>
|
||||
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%>
|
||||
<% eu = ExerciseUser.where("exercise_id=? and user_id=? and status=?",exercise.id, User.current.id, true).first %>
|
||||
<% if exercise.end_time <= Time.now && eu && exercise.end_time >= eu.created_at %>
|
||||
<li class="pollsbtn_tip fl ml5">已答</li>
|
||||
<% end %>
|
||||
<%#end%>
|
||||
<div>
|
||||
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :title => "#{exercise_name}", :class => "polls_title polls_title_st fl c_dblue "%>
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<span class="exercise_status_nop fl"></span>
|
||||
<% elsif exercise.exercise_status == 2 %>
|
||||
<span class="exercise_status_pub fl"></span>
|
||||
<% else %>
|
||||
<span class="exercise_status_end fl"></span>
|
||||
<% end%>
|
||||
<% if eu && exercise.end_time >= eu.created_at %>
|
||||
<span class="exercise_status_com fl ml5"></span>
|
||||
<% else %>
|
||||
<span class="exercise_status_nocom fl ml5"></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10">
|
||||
<span class="c_grey fl mr15">测试时长:<%= exercise.time.nil? || exercise.time == -1 ? '不限' : exercise.time.to_s + "分钟" %></span>
|
||||
<span class="c_grey fl mr15">截止时间:<%= exercise.end_time.nil? ? '未设置' : format_time(exercise.end_time) %></span>
|
||||
<span class="c_grey fl mr15">发布时间:<%= exercise.publish_time.nil? ? '未设置' : format_time(exercise.publish_time) %></span>
|
||||
|
||||
<% exercise_end = exercise.end_time > Time.now
|
||||
if exercise.time == -1 || exercise.time.nil?
|
||||
can_edit_excercise = exercise_end
|
||||
else
|
||||
can_edit_excercise = !has_commit_exercise?(exercise.id,User.current.id)&& exercise_end
|
||||
end%>
|
||||
<% if can_edit_excercise && eu %>
|
||||
<a href="<%=exercise_path(exercise.id) %>" class="pollsbtn btn_pu fr mr10 ml5">继续答题</a>
|
||||
<% elsif can_edit_excercise %>
|
||||
<a href="<%=exercise_path(exercise.id) %>" class="pollsbtn btn_pu fr mr10 ml5">开始答题</a>
|
||||
<% else %>
|
||||
<a href="<%=exercise_path(exercise.id) %>" class="pollsbtn btn_pu fr mr10 ml5">查看答题</a>
|
||||
<% end %>
|
||||
<% if exercise.show_result == 1 %>
|
||||
<% if exercise.end_time <= Time.now %>
|
||||
<%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%>
|
||||
<% else %>
|
||||
<div class="pollsbtn fr mr10 pollsbtn_grey" title="截止时间还未到,暂不可查看统计结果">统计结果</div>
|
||||
<%end%>
|
||||
<% end %>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<% end%>
|
||||
<li class="polls_date fr mr10">截止时间:<%= format_time(exercise.end_time.to_s)%></li>
|
||||
<% if exercise.show_result == 1 %>
|
||||
<% if exercise.end_time <= Time.now %>
|
||||
<li><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%></li>
|
||||
<% else %>
|
||||
<li class="pollsbtn fr mr10 pollsbtn_grey" title="截止时间未到,暂不能查看统计结果">统计结果</li>
|
||||
<%end%>
|
||||
<% end %>
|
||||
|
||||
<% end%>
|
||||
<script>
|
||||
function delete_exercise(id){
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f16">您确定要删除吗</p><div class="cl"></div><a href="/exercise/'+ id +'" class="fr sy_btn_blue mr90 mt10" data-method="delete" data-remote="true">确定</a>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取消</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
}
|
||||
</script>
|
|
@ -33,7 +33,7 @@
|
|||
<td class="hworkList130 c_grey">
|
||||
<% if exercise.created_at%>
|
||||
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>
|
||||
<% if @exercise.end_time <= exercise.created_at %>
|
||||
<% if exercise.commit_status == 0 %>
|
||||
<span class="c_red">[未答]</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -5,31 +5,16 @@
|
|||
});
|
||||
function republish_exercise(exercise_id,index)
|
||||
{
|
||||
$('#ajax-modal').html("<div id='popbox02'>" +
|
||||
"<div class='upload_con'>" +
|
||||
"<div class='upload_box'>" +
|
||||
"<p class='polls_box_p'>取消发布后学生答题将会被清空<br />是否确定取消发布该测验?</p>" +
|
||||
"<div class='polls_btn_box'>" +
|
||||
"<a href='/exercise/"+ exercise_id +"/republish_exercise?index="+index+"' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
||||
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
||||
"</div>" +
|
||||
"<div class='cl'></div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
showModal('ajax-modal', '310px');
|
||||
$('#ajax-modal').css('height','120px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>取消发布后学生答题将会被清空<br />是否确定取消发布该试卷?</p>' +
|
||||
'<a href="javascript:void(0);" class="btn btn-grey mt10 mr10" onclick="hideModal();">取 消</a>' +
|
||||
'<a href="/exercise/'+ exercise_id +'/republish_exercise?index='+ index +'" class="btn btn-blue mt10" onclick="hideModal();" data-remote="true">确 定</a></div></div></div>';
|
||||
pop_box_new(htmlvalue, 400, 152);
|
||||
}
|
||||
|
||||
function clickCanel(){hideModal("#popbox02");}
|
||||
|
||||
function exercise_submit(exercise_id,exercise_name,index)
|
||||
function exercise_submit(status, exercise_id,exercise_name,index)
|
||||
{
|
||||
if(exercise_name == 0)
|
||||
{
|
||||
|
@ -37,29 +22,31 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
$('#ajax-modal').html("<div id='popbox02'>" +
|
||||
"<div class='upload_con'>" +
|
||||
"<div class='upload_box'>" +
|
||||
"<p class='polls_box_p'>测验发布后将不能对测验进行修改,<br />是否确定发布该测验?</p>" +
|
||||
"<div class='polls_btn_box'>" +
|
||||
"<a href='/exercise/"+ exercise_id +"/publish_exercise?index="+index+"' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
||||
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
||||
"</div>" +
|
||||
"<div class='cl'></div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
showModal('ajax-modal', '310px');
|
||||
$('#ajax-modal').css('height','120px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
if (status == 1){
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>您还没有设置截止时间,请先设置截止时间再发布</p>' +
|
||||
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>';
|
||||
pop_box_new(htmlvalue, 400, 152);
|
||||
} else if(status == 2){
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>您设置的截止时间已过期,请重新设置</p>' +
|
||||
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>';
|
||||
pop_box_new(htmlvalue, 400, 152);
|
||||
} else{
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>发布后不能再对试卷进行修改<br/>是否确定发布</p>' +
|
||||
'<a href="javascript:void(0);" class="btn btn-grey mt10 mr10" onclick="hideModal();">取 消</a>' +
|
||||
'<a href="/exercise/'+ exercise_id +'/publish_exercise?index='+ index +'" class="btn btn-blue mt10" onclick="hideModal();" data-remote="true">确 定</a></div></div></div>';
|
||||
pop_box_new(htmlvalue, 400, 152);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function delete_exercise(id){
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您是否确定删除</p><div class="cl"></div><a href="/exercise/'+ id +'" class="fr sy_btn_blue mr90 mt10" data-method="delete" data-remote="true">确定</a>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取消</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
}
|
||||
</script>
|
||||
<div class="courseRSide fl" id="homework_page_right">
|
||||
<div class="polls_content02" id="exercise" style="width: 730px;">
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>");
|
||||
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>");
|
||||
showModal('ajax-modal', '250px');
|
||||
//$('#ajax-modal').css('height','111px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("poll_alert_form");
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>发布成功</p>' +
|
||||
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>';
|
||||
pop_box_new(htmlvalue, 400, 152);
|
|
@ -1,10 +1,5 @@
|
|||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>");
|
||||
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
|
||||
showModal('ajax-modal', '250px');
|
||||
//$('#ajax-modal').css('height','80px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("poll_alert_form");
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>取消成功</p>' +
|
||||
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>';
|
||||
pop_box_new(htmlvalue, 400, 152);
|
|
@ -0,0 +1,15 @@
|
|||
class AddColumnToExerciseUsers < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :exercise_users, :commit_status, :integer, :default => 0
|
||||
count = ExerciseUser.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
ExerciseUser.page(i).per(30).each do |eu|
|
||||
if eu.exercise && eu.exercise.end_time < Time.now && eu.exercise.end_time > eu.created_at
|
||||
eu.update_column('commit_status', 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20161114092115) do
|
||||
ActiveRecord::Schema.define(:version => 20161117060138) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -806,10 +806,11 @@ ActiveRecord::Schema.define(:version => 20161114092115) do
|
|||
t.integer "exercise_id"
|
||||
t.integer "score"
|
||||
t.datetime "start_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "end_at"
|
||||
t.integer "status"
|
||||
t.integer "commit_status", :default => 0
|
||||
end
|
||||
|
||||
create_table "exercises", :force => true do |t|
|
||||
|
@ -1910,6 +1911,7 @@ ActiveRecord::Schema.define(:version => 20161114092115) do
|
|||
t.float "work_score"
|
||||
t.integer "work_status", :default => 0
|
||||
t.datetime "commit_time"
|
||||
t.integer "is_delete", :default => 0
|
||||
end
|
||||
|
||||
add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id"
|
||||
|
|
|
@ -24,8 +24,10 @@ namespace :exercise_publish do
|
|||
course = exercise.course
|
||||
exercise.update_column('exercise_status', 3)
|
||||
course.student.each do |student|
|
||||
if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,exercise.id).empty?
|
||||
if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,exercise.id).blank?
|
||||
ExerciseUser.create(:user_id => student.student_id, :exercise_id => exercise.id, :start_at => exercise.end_time, :status => true,:score=>0)
|
||||
else
|
||||
ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,exercise.id).first.update_column('commit_status', 1)
|
||||
end
|
||||
=begin
|
||||
s_score = calculate_student_score(exercise, student.student)
|
||||
|
|
|
@ -181,6 +181,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
|
|||
.mw20{ margin: 0 20px;}
|
||||
.mw380 {max-width: 380px !important;}
|
||||
.mw400 {max-width: 400px !important;}
|
||||
.mw450 {max-width: 450px !important;}
|
||||
.mt-20 {margin-top:-20px;}
|
||||
.mt-10 {margin-top:-10px;}
|
||||
.mt-4 {margin-top:-4px;}
|
||||
|
|
|
@ -21,6 +21,8 @@ input.radio-width90{ width: 90px; }
|
|||
/*模板buttons 20161013byLB*/
|
||||
.btn{display: inline-block;border:none; padding:0 10px;color: #333;background: #e1e1e1; text-align:center;font-size: 12px; height: 30px;line-height: 30px;-webkit-border-radius: 3px;-moz-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; }
|
||||
.btn:hover{background: #c3c3c3; color: #333;}
|
||||
.btn-grey{background: #d9d9d9; color: #656565;}
|
||||
.btn-grey:hover{background: #717171; color: #fff;}
|
||||
.btn-green{background: #60b25e; color: #fff;}
|
||||
.btn-green:hover{background: #51a74f; color: #fff;}
|
||||
.btn-blue{background: #3b94d6; color: #fff;}
|
||||
|
|
Loading…
Reference in New Issue