Merge branch 'develop' into educoder

dev_trainings
daiao 6 years ago
commit db3422a8f1

@ -30,9 +30,9 @@ class HomeworkCommonController < ApplicationController
@homework_type = params[:homework_type].to_i @homework_type = params[:homework_type].to_i
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
if @search if @search
@homework_commons = @course.homework_commons.where(:homework_type => @homework_type).where("homework_commons.name like '%#{@search}%'").includes(:homework_detail_manual, :homework_group_settings, :student_works) @homework_commons = @course.homework_commons.where(:homework_type => @homework_type).where("homework_commons.name like '%#{@search}%'")
else else
@homework_commons = @course.homework_commons.where(:homework_type => @homework_type).includes(:homework_detail_manual, :homework_group_settings, :student_works) @homework_commons = @course.homework_commons.where(:homework_type => @homework_type)
end end
if @is_teacher if @is_teacher
@homework_commons = @homework_commons @homework_commons = @homework_commons
@ -72,6 +72,9 @@ class HomeworkCommonController < ApplicationController
@is_new = params[:is_new] @is_new = params[:is_new]
@homeworks = paginateHelper @homework_commons,15 @homeworks = paginateHelper @homework_commons,15
@homeworks = @homework_type == 4 ? @homeworks.includes(:homework_detail_manual, :homework_group_settings, [homework_commons_shixuns: :shixun]) :
@homeworks.includes(:homework_detail_manual, :homework_group_settings)
#设置at已读 #设置at已读
=begin =begin
ids = @homeworks.inject([]) do |ids, homework| ids = @homeworks.inject([]) do |ids, homework|

@ -586,9 +586,9 @@ class StudentWorkController < ApplicationController
if @stundet_works.size != 0 if @stundet_works.size != 0
if @order == "student_id" if @order == "student_id"
@stundet_works = @stundet_works.includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).order("user_extensions.student_id #{@b_sort}") @stundet_works = @stundet_works.includes(:user => {:user_extensions => []}).order("user_extensions.student_id #{@b_sort}")
else else
@stundet_works = @stundet_works.includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).order("#{@order} #{@b_sort}") @stundet_works = @stundet_works.order("#{@order} #{@b_sort}")
end end
end end
@ -609,6 +609,16 @@ class StudentWorkController < ApplicationController
@student_work_pages = Paginator.new @student_work_count, @limit, @page @student_work_pages = Paginator.new @student_work_count, @limit, @page
@offset ||= @student_work_pages.offset @offset ||= @student_work_pages.offset
@stundet_works = paginateHelper @stundet_works, @limit @stundet_works = paginateHelper @stundet_works, @limit
if @stundet_works.size != 0
@stundet_works = if @homework.homework_type == 1
@stundet_works.includes(:student_works_scores, [user: :user_extensions])
elsif @homework.homework_type == 3
@stundet_works.includes(:student_works_scores, [project: :project_score], [user: :user_extensions])
elsif @homework.homework_type == 4
@stundet_works.includes(:student_works_scores, [myshixun: :games], [user: :user_extensions])
end
@members = @course.members.where(user_id: @stundet_works.pluck(:user_id)).select([:user_id, :course_group_id])
end
respond_to do |format| respond_to do |format|
format.js format.js
format.html { render :layout => 'base_edu'} format.html { render :layout => 'base_edu'}

@ -191,7 +191,7 @@ module ApplicationHelper
# 分班 # 分班
def member_group_name members, user_id def member_group_name members, user_id
member = members.where(:user_id => user_id).first member = members.find_by_user_id(user_id)
group_name = member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.name group_name = member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.name
end end
@ -269,12 +269,12 @@ module ApplicationHelper
end end
# 实训作品列表的提交状态 # 实训作品列表的提交状态
def list_work_status work, homework, member def list_work_status work, homework, course_group_id
if work.work_status == 0 if work.work_status == 0
str = "未提交" str = "未提交"
else else
if work.compelete_status == 0 if work.compelete_status == 0
setting_time = homework_group_setting homework, member.try(:course_group_id) setting_time = homework_group_setting homework, course_group_id
end_time = setting_time.end_time.present? ? setting_time.end_time : homework.end_time end_time = setting_time.end_time.present? ? setting_time.end_time : homework.end_time
if end_time > Time.now || (homework.allow_late && !homework.course.is_end) if end_time > Time.now || (homework.allow_late && !homework.course.is_end)
str = "正在提交" str = "正在提交"
@ -1319,11 +1319,11 @@ module ApplicationHelper
def had_commit_studentwork_count homework_common def had_commit_studentwork_count homework_common
member = homework_common.course.members.where(:user_id => User.current.id).first member = homework_common.course.members.where(:user_id => User.current.id).first
student_works = homework_common.student_works student_works = homework_common.student_works
if member.present? && member.teacher_course_groups.count > 0 if member.present? && member.teacher_course_groups.size > 0
group_students = homework_common.course.members.where(:course_group_id => member.teacher_course_groups.pluck(:course_group_id)).map(&:user_id) group_students = homework_common.course.members.where(:course_group_id => member.teacher_course_groups.pluck(:course_group_id)).map(&:user_id)
student_works = student_works.where(:user_id => group_students) student_works = student_works.where(:user_id => group_students)
end end
student_works.where("work_status !=?", 0).count student_works.where("work_status !=?", 0).size
end end
# 实训作业的有效作品数 # 实训作业的有效作品数
@ -1359,11 +1359,11 @@ module ApplicationHelper
def had_uncommit_studentwork_count homework_common def had_uncommit_studentwork_count homework_common
member = homework_common.course.members.where(:user_id => User.current.id).first member = homework_common.course.members.where(:user_id => User.current.id).first
student_works = homework_common.student_works student_works = homework_common.student_works
if member.present? && member.teacher_course_groups.count > 0 if member.present? && member.teacher_course_groups.size > 0
group_students = homework_common.course.members.where(:course_group_id => member.teacher_course_groups.pluck(:course_group_id)).map(&:user_id) group_students = homework_common.course.members.where(:course_group_id => member.teacher_course_groups.pluck(:course_group_id)).map(&:user_id)
student_works = student_works.where(:user_id => group_students) student_works = student_works.where(:user_id => group_students)
end end
student_works.where("work_status =?", 0).count student_works.where("work_status =?", 0).size
end end
# 未评阅 # 未评阅
@ -1371,12 +1371,12 @@ module ApplicationHelper
#count = StudentWorksScore.find_by_sql("SELECT count(distinct student_work_id) as count FROM student_works_scores sws, student_works sw, homework_commons hc where hc.id =#{homework_common.id} and sw.homework_common_id=hc.id and sw.is_delete = 0 and sws.student_work_id = sw.id and sws.user_id=#{User.current.id};").first.try(:count).to_i #count = StudentWorksScore.find_by_sql("SELECT count(distinct student_work_id) as count FROM student_works_scores sws, student_works sw, homework_commons hc where hc.id =#{homework_common.id} and sw.homework_common_id=hc.id and sw.is_delete = 0 and sws.student_work_id = sw.id and sws.user_id=#{User.current.id};").first.try(:count).to_i
member = homework_common.course.members.where(:user_id => User.current.id).first member = homework_common.course.members.where(:user_id => User.current.id).first
student_works = homework_common.student_works student_works = homework_common.student_works
if member.present? && member.teacher_course_groups.count > 0 if member.present? && member.teacher_course_groups.size > 0
group_students = homework_common.course.members.where(:course_group_id => member.teacher_course_groups.pluck(:course_group_id)).map(&:user_id) group_students = homework_common.course.members.where(:course_group_id => member.teacher_course_groups.pluck(:course_group_id)).map(&:user_id)
student_works = student_works.where(:user_id => group_students) student_works = student_works.where(:user_id => group_students)
end end
has_comment = StudentWorksScore.where(:student_work_id => student_works.map(&:id), :reviewer_role => [1, 2]).group_by(&:student_work_id).count has_comment = StudentWorksScore.where(:student_work_id => student_works.map(&:id), :reviewer_role => [1, 2]).group_by(&:student_work_id).size
student_count = student_works.count student_count = student_works.size
return student_count - has_comment return student_count - has_comment
end end
@ -6570,7 +6570,7 @@ def update_shixun_work_status homework
else else
setting = homework.homework_group_settings.where("publish_time < '#{Time.now}'") setting = homework.homework_group_settings.where("publish_time < '#{Time.now}'")
if setting.blank? if setting.blank?
student_works = student_works.where("0=1") student_works = student_works.none
else else
users = homework.course.members.where(:course_group_id => setting.map(&:course_group_id)) users = homework.course.members.where(:course_group_id => setting.map(&:course_group_id))
student_works = student_works.where(:user_id => users.map(&:user_id)) student_works = student_works.where(:user_id => users.map(&:user_id))
@ -6580,7 +6580,7 @@ def update_shixun_work_status homework
myshixuns = Myshixun.where(:shixun_id => shixun.id, :user_id => student_works.map(&:user_id)) myshixuns = Myshixun.where(:shixun_id => shixun.id, :user_id => student_works.map(&:user_id))
myshixuns.each do |myshixun| myshixuns.each do |myshixun|
work = student_works.where(:user_id => myshixun.user_id).first work = student_works.where(:user_id => myshixun.user_id).first
member = Member.find_by_sql("select course_group_id from members where course_id = #{homework.course_id} and user_id = #{work.user_id}").first member = homework.course.members.find_by(:user_id => work.user_id)
setting_time = homework_group_setting homework, member.try(:course_group_id) setting_time = homework_group_setting homework, member.try(:course_group_id)
games = myshixun.games.where(:challenge_id => challeng_ids) games = myshixun.games.where(:challenge_id => challeng_ids)
myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil
@ -7222,8 +7222,8 @@ def search_work_member works,name
select_works = works select_works = works
else else
name = name.downcase name = name.downcase
select_works = works.select{ |work| work.user.user_extensions[:student_id].to_s.downcase.include?(name) || (work.user[:lastname].to_s.downcase + work.user[:firstname].to_s.downcase).include?(name) select_works = works.joins(user: :user_extensions).where("concat(lastname, firstname) like ?
} or student_id like ?", "%#{name}%", "%#{name}%")
end end
select_works select_works
end end

@ -150,7 +150,7 @@ class HomeworkCommon < ActiveRecord::Base
# 作业的实训 # 作业的实训
def shixun def shixun
Shixun.find(self.homework_commons_shixuns.try(:shixun_id)) homework_commons_shixuns.shixun
end end
# 作业实训过关的数目 # 作业实训过关的数目

@ -61,22 +61,22 @@
<% end %> <% end %>
<% end %> <% end %>
<%# elsif homework_common.homework_type != 4 %> <%# elsif homework_common.homework_type != 4 %>
<% else %> <%# else %>
<% if had_commit_studentwork_count(homework_common) > 0 %> <%# if had_commit_studentwork_count(homework_common) > 0 %>
<span class="ml50 fl"> <!-- <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' %> <%#= link_to had_commit_studentwork_count(homework_common), student_work_index_path(:homework => homework_common.id), :class => 'color-orange03 mr5', :target => '_blank' %>
已交 <!-- 已交-->
</span> <!-- </span>-->
<%# if homework_common.homework_type == 4 %> <%# if homework_common.homework_type == 4 %>
<!--<span class="ml50">--> <!--<span class="ml50">-->
<!--<a href="javascript:void(0);" class="color-orange03 mr5" style="cursor: default"><%#= homework_common.pass_game_count %></a>通关--> <!--<a href="javascript:void(0);" class="color-orange03 mr5" style="cursor: default"><%#= homework_common.pass_game_count %></a>通关-->
<!--</span>--> <!--</span>-->
<%# end %> <%# end %>
<span class="ml50 fl"> <!-- <span class="ml50 fl">-->
<%= link_to had_uncommit_studentwork_count(homework_common), student_work_index_path(:homework => homework_common.id), :class => 'color-orange03 mr5', :target => '_blank' %> <%#= link_to had_uncommit_studentwork_count(homework_common), student_work_index_path(:homework => homework_common.id), :class => 'color-orange03 mr5', :target => '_blank' %>
未交 <!-- 未交-->
</span> <!-- </span>-->
<% end %> <%# end %>
<%# elsif homework_common.homework_type == 4 && homework_common.homework_commons_shixuns.shixun %> <%# 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) %> <%# 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 %> <%# challenge_count = homework_common.homework_commons_shixuns.shixun.challenges.count %>
@ -129,7 +129,7 @@
<%= link_to "创建项目", new_project_path(:host=>Setting.host_name, :course_id => homework_common.course_id), :class => 'white-btn orange-btn fr mr10 mt8', :target => "_blank" %> <%= link_to "创建项目", new_project_path(:host=>Setting.host_name, :course_id => homework_common.course_id), :class => 'white-btn orange-btn fr mr10 mt8', :target => "_blank" %>
<% end %> <% end %>
<% elsif homework_common.homework_type == 4 && homework_common.homework_commons_shixuns.shixun %> <% elsif homework_common.homework_type == 4 && homework_common.homework_commons_shixuns.shixun %>
<%= link_to "实训详情", shixun_path(Shixun.find(homework_common.homework_commons_shixuns.shixun_id)), :target => "_blank", :class => 'white-btn orange-btn fr mr10 mt8' %> <%= link_to "实训详情", shixun_path(homework_common.homework_commons_shixuns.shixun.try(:identifier)), :target => "_blank", :class => 'white-btn orange-btn fr mr10 mt8' %>
<% end %> <% end %>
<% if @is_teacher %> <% if @is_teacher %>
@ -148,7 +148,7 @@
<li> <li>
<%= link_to '立即发布', publish_notice_homework_common_path(homework_common), :remote => true %> <%= link_to '立即发布', publish_notice_homework_common_path(homework_common), :remote => true %>
</li> </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 && homework_common.end_time > Time.now %>
<li> <li>
<%= link_to '立即截止', end_notice_homework_common_path(homework_common), :remote => true %> <%= link_to '立即截止', end_notice_homework_common_path(homework_common), :remote => true %>
</li> </li>

@ -13,9 +13,9 @@
</li> </li>
<% unless course_board.children.empty? %> <% unless course_board.children.empty? %>
<ul> <ul>
<% course_board.children.reorder("position asc").each do |board| %> <% course_board.children.includes(:messages).reorder("position asc").each do |board| %>
<li id="board_children_<%= board.id %>" class="clearfix"> <li id="board_children_<%= board.id %>" class="clearfix">
<% count = board ? board.messages.count : 0 %> <% count = board ? board.messages.size : 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> <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 %> <% if count > 0 %>
<span class="fr mr30 courseNewNum"><%= count %></span> <span class="fr mr30 courseNewNum"><%= count %></span>

@ -17,9 +17,9 @@
</a> </a>
</li> </li>
<% end %> <% end %>
<% @course.course_groups.each do |group| %> <% @course.course_groups.includes(:members).each do |group| %>
<li id="course_group_<%=group.id %>" class="clearfix"> <li id="course_group_<%=group.id %>" class="clearfix">
<% count = group.members.count %> <% count = group.members.size %>
<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> <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 %> <% if count > 0 %>
<span class="fl ml10 color-grey-9 font-12 groupNum"><%= count %></span> <span class="fl ml10 color-grey-9 font-12 groupNum"><%= count %></span>

@ -1,20 +1,22 @@
<li class="clearfix tableHead"> <li class="clearfix tableHead">
<span>序号</span> <span>序号</span>
<span>客户名称</span> <span>客户名称</span>
<span><a href="<%= customers_list_managements_path(:partner_id => @current_partner.try(:id)) %>" <span>
data-remote="true" class="color-blue">+添加</a></span> <a href="<%= customers_list_managements_path(:partner_id => @current_partner.try(:id)) %>"
data-remote="true" class="color-blue">+添加</a>
</span>
<span>添加时间</span> <span>添加时间</span>
</li> </li>
<% @current_partner.try(:customers).try(:each_with_index) do |customer, index| %> <% @current_partner.try(:customers).try(:each_with_index) do |customer, index| %>
<li> <li>
<span><%= index + 1 %></span> <span><%= index + 1 %></span>
<span class="task-hide"><%= customer.school.name %></span> <a href="<%= customer.school.statistic_url %>" target="_blank" class="color-blue"><%= customer.school.name %></a>
<span> <span>
<a href="javascript:void(0)" onclick="delete_confirm_box_2('<%= delete_customers_managements_path(customer: customer.id, partner_id: @current_partner.try(:id)) %>', <a href="javascript:void(0)" onclick="delete_confirm_box_2('<%= delete_customers_managements_path(customer: customer.id, partner_id: @current_partner.try(:id)) %>',
'确定要删除该客户吗')" class="color-grey-9">删除</a> '确定要删除该客户吗')" class="color-grey-9">删除</a>
</span> </span>
<span> <span>
<%= format_time customer.created_at %> <%= format_time customer.created_at %>
</span> </span>
</li> </li>
<% end %> <% end %>

@ -4,7 +4,7 @@
<div class="fr mr10 edu-menu-panel mt5"> <div class="fr mr10 edu-menu-panel mt5">
<i class="iconfont icon-sandian color-grey-9 font-14"></i> <i class="iconfont icon-sandian color-grey-9 font-14"></i>
<ul class="edu-menuSmall-list edu-txt-center"> <ul class="edu-menuSmall-list edu-txt-center">
<li><a href="<%= partners_managements_path(:partner => partner) %>">查看</a></li> <li><a href="<%= partner_list_cooperate_path partner %>">查看</a></li>
<li><a href="javascript:void(0)" onclick="delPartners('<%= delete_partner_managements_path(:partner_id => partner) %>');">删除</a></li> <li><a href="javascript:void(0)" onclick="delPartners('<%= delete_partner_managements_path(:partner_id => partner) %>');">删除</a></li>
</ul> </ul>
</div> </div>

@ -28,7 +28,8 @@
<td> <td>
<a href="/users/<%= (student_work.user.try(:login)) %>" class="color-grey3"><%= student_work.user.show_real_name %></a> <a href="/users/<%= (student_work.user.try(:login)) %>" class="color-grey3"><%= student_work.user.show_real_name %></a>
</td> </td>
<% group_name = new_member_group_name @course.id, student_work.user_id %> <% group_id = @members.select{|m|m.user_id==student_work.user_id}.first.try(:course_group_id) %>
<% group_name = group_id.to_i == 0 ? '未分班' : @course.course_groups.find_by_id(group_id).name %>
<td title="<%= group_name %>"> <td title="<%= group_name %>">
<span class="task-hide" style="display: block;max-width: 120px;"><%= group_name %></span> <span class="task-hide" style="display: block;max-width: 120px;"><%= group_name %></span>
</td> </td>

@ -33,7 +33,8 @@
<td> <td>
<a href="/users/<%= (student_work.user.try(:login)) %>" class="color-grey3"><%= student_work.user.show_real_name %></a> <a href="/users/<%= (student_work.user.try(:login)) %>" class="color-grey3"><%= student_work.user.show_real_name %></a>
</td> </td>
<% group_name = member_group_name @homework.course.members, student_work.user_id %> <% group_id = @members.select{|m|m.user_id==student_work.user_id}.first.try(:course_group_id) %>
<% group_name = group_id.to_i == 0 ? '未分班' : @course.course_groups.find_by_id(group_id).name %>
<td title="<%= group_name %>"> <td title="<%= group_name %>">
<span class="task-hide" style="display: block;max-width: 120px;"><%= group_name %></span> <span class="task-hide" style="display: block;max-width: 120px;"><%= group_name %></span>
</td> </td>

@ -25,8 +25,8 @@
<td> <td>
<a href="/users/<%= (student_work.user.try(:login)) %>" class="color-grey3"><%= student_work.user.show_real_name %></a> <a href="/users/<%= (student_work.user.try(:login)) %>" class="color-grey3"><%= student_work.user.show_real_name %></a>
</td> </td>
<% member = Member.find_by_sql("select course_group_id from members where course_id = #{@homework.course_id} and user_id = #{student_work.user_id}").first %> <% group_id = @members.select{|m|m.user_id==student_work.user_id}.first.try(:course_group_id) %>
<% group_name = member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.name %> <% group_name = group_id.to_i == 0 ? '未分班' : @course.course_groups.find_by_id(group_id).name %>
<td title="<%= group_name %>"> <td title="<%= group_name %>">
<span class="task-hide"><%= group_name %></span> <span class="task-hide"><%= group_name %></span>
</td> </td>
@ -35,7 +35,7 @@
<%= student_id %> <%= student_id %>
</td> </td>
<td> <td>
<% status = list_work_status student_work, @homework, member %> <% status = list_work_status student_work, @homework, group_id %>
<span class='<%= status == "未提交" ? "" : ((status == "按时提交" || status == "正在提交") ? "color-light-green" : "color-red") %>'><%= status %></span> <span class='<%= status == "未提交" ? "" : ((status == "按时提交" || status == "正在提交") ? "color-light-green" : "color-red") %>'><%= status %></span>
</td> </td>
<td data-tip-down='<%= student_work.compelete_status == 0 ? "还未完成" : (student_work.compelete_status == 2 ? "已于发布前完成作品" : "自发布#{work_spend_time(student_work.cost_time)}后提交了最终作品") %>'> <td data-tip-down='<%= student_work.compelete_status == 0 ? "还未完成" : (student_work.compelete_status == 2 ? "已于发布前完成作品" : "自发布#{work_spend_time(student_work.cost_time)}后提交了最终作品") %>'>

@ -71,7 +71,7 @@
<a href="javascript:void(0);" class="tab_type">参考答案</a> <a href="javascript:void(0);" class="tab_type">参考答案</a>
</li> </li>
<% end %> <% end %>
<% if @is_teacher && @homework.homework_type == 4 && @homework.homework_group_reviews.count > 0 %> <% if @is_teacher && @homework.homework_type == 4 && @homework.homework_group_reviews.size > 0 %>
<li id="edu-tab-nav-5" index="5"> <li id="edu-tab-nav-5" index="5">
<a href="javascript:void(0);" class="tab_type"> <a href="javascript:void(0);" class="tab_type">
查重结果 查重结果
@ -100,16 +100,16 @@
<% end %> <% end %>
<%= link_to "导出成绩", student_work_index_path(:homework => @homework.id, :order => @order, :sort => @b_sort, :name => @name, :group => @group, :comment => @comment, :status => @status, :format => 'xls'), :class => 'fr mt3 ml15 white-btn orange-btn', :id => "export_student_work" %> <%= link_to "导出成绩", student_work_index_path(:homework => @homework.id, :order => @order, :sort => @b_sort, :name => @name, :group => @group, :comment => @comment, :status => @status, :format => 'xls'), :class => 'fr mt3 ml15 white-btn orange-btn', :id => "export_student_work" %>
<% if @homework.homework_detail_manual.try(:comment_status) == 0 || @homework.homework_group_settings.where("publish_time is null or publish_time > '#{Time.now}'").count > 0 %> <% if @homework.homework_detail_manual.try(:comment_status) == 0 || @homework.homework_group_settings.where("publish_time is null or publish_time > '#{Time.now}'").size > 0 %>
<%= link_to '立即发布', publish_notice_homework_common_path(@homework), :remote => true, :class => "white-btn orange-btn fr ml15 mt3" %> <%= link_to '立即发布', publish_notice_homework_common_path(@homework), :remote => true, :class => "white-btn orange-btn fr ml15 mt3" %>
<% end %> <% end %>
<% if (@homework.homework_detail_manual.try(:comment_status) == 1 && @homework.end_time > Time.now) || @homework.homework_group_settings.where("publish_time < '#{Time.now}' and end_time > '#{Time.now}'").count > 0 %> <% if (@homework.homework_detail_manual.try(:comment_status) == 1 && @homework.end_time > Time.now) || @homework.homework_group_settings.where("publish_time < '#{Time.now}' and end_time > '#{Time.now}'").size > 0 %>
<%= link_to '立即截止', end_notice_homework_common_path(@homework), :remote => true, :class => "white-btn orange-btn fr ml15 mt3" %> <%= link_to '立即截止', end_notice_homework_common_path(@homework), :remote => true, :class => "white-btn orange-btn fr ml15 mt3" %>
<% end %> <% end %>
<% if @homework.publish_time.present? && @homework.publish_time < Time.now && @homework.end_time > Time.now && (@homework.homework_type == 1 || @homework.homework_type == 3) %> <% if @homework.publish_time.present? && @homework.publish_time < Time.now && @homework.end_time > Time.now && (@homework.homework_type == 1 || @homework.homework_type == 3) %>
<a href="javascript:void(0)" class="white-btn orange-btn fr ml15 mt3" onclick="cancel_publish('<%= cancel_publish_homework_common_path(@homework) %>')">撤销发布</a> <a href="javascript:void(0)" class="white-btn orange-btn fr ml15 mt3" onclick="cancel_publish('<%= cancel_publish_homework_common_path(@homework) %>')">撤销发布</a>
<% end %> <% end %>
<% if @homework.homework_type == 4 && @homework.publish_time.present? && @homework.publish_time < Time.now && @homework.homework_group_reviews.count == 0 %> <% if @homework.homework_type == 4 && @homework.publish_time.present? && @homework.publish_time < Time.now && @homework.homework_group_reviews.size == 0 %>
<a href="<%= homework_code_repeat_homework_common_path(@homework) %>" data-remote="true" class="fr white-btn edu-greenline-btn ml15 mt3">代码查重</a> <a href="<%= homework_code_repeat_homework_common_path(@homework) %>" data-remote="true" class="fr white-btn edu-greenline-btn ml15 mt3">代码查重</a>
<% end %> <% end %>
</div> </div>
@ -185,7 +185,7 @@
<span class="fl mr25"> <span class="fl mr25">
<a href="javascript:void(0);" id="comment_no_limit" class="<%= @comment.blank? ? 'check_on' : '' %> pl10 pr10">不限</a> <a href="javascript:void(0);" id="comment_no_limit" class="<%= @comment.blank? ? 'check_on' : '' %> pl10 pr10">不限</a>
</span> </span>
<% has_comment = StudentWorksScore.where(:student_work_id => student_works.map(&:id), :reviewer_role => [1, 2]).group_by(&:student_work_id).count %> <% has_comment = StudentWorksScore.where(:student_work_id => student_works.map(&:id), :reviewer_role => [1, 2]).group_by(&:student_work_id).size %>
<input id="not_comment" class="magic-checkbox fl" type="checkbox" value="0" name="comment[]" <%= !@comment.blank? && @comment.include?('0') ? 'checked' : '' %>> <input id="not_comment" class="magic-checkbox fl" type="checkbox" value="0" name="comment[]" <%= !@comment.blank? && @comment.include?('0') ? 'checked' : '' %>>
<label for="not_comment" class="fl mr25">未评(<%= @student_work_count - has_comment %>)</label> <label for="not_comment" class="fl mr25">未评(<%= @student_work_count - has_comment %>)</label>
<input id="has_comment" class="magic-checkbox fl" type="checkbox" value="1" name="comment[]" <%= !@comment.blank? && @comment.include?('1') ? 'checked' : '' %>> <input id="has_comment" class="magic-checkbox fl" type="checkbox" value="1" name="comment[]" <%= !@comment.blank? && @comment.include?('1') ? 'checked' : '' %>>
@ -198,11 +198,11 @@
<a href="javascript:void(0);" id="status_no_limit" class="<%= @status.blank? ? 'check_on' : '' %> pl10 pr10">不限</a> <a href="javascript:void(0);" id="status_no_limit" class="<%= @status.blank? ? 'check_on' : '' %> pl10 pr10">不限</a>
</span> </span>
<input id="work_status_1" class="magic-checkbox fl" type="checkbox" value="0" name="status[]" <%= !@status.blank? && @status.include?('0') ? 'checked' : '' %>> <input id="work_status_1" class="magic-checkbox fl" type="checkbox" value="0" name="status[]" <%= !@status.blank? && @status.include?('0') ? 'checked' : '' %>>
<label for="work_status_1" class="fl mr25">未提交(<%= @all_student_works.where(:work_status => 0).count %>)</label> <label for="work_status_1" class="fl mr25">未提交(<%= @all_student_works.where(:work_status => 0).size %>)</label>
<input id="work_status_2" class="magic-checkbox fl" type="checkbox" value="1" name="status[]" <%= !@status.blank? && @status.include?('1') ? 'checked' : '' %>> <input id="work_status_2" class="magic-checkbox fl" type="checkbox" value="1" name="status[]" <%= !@status.blank? && @status.include?('1') ? 'checked' : '' %>>
<label for="work_status_2" class="fl mr25">按时提交(<%= student_works.where(:work_status => 1).count %>)</label> <label for="work_status_2" class="fl mr25">按时提交(<%= student_works.where(:work_status => 1).size %>)</label>
<input id="work_status_3" class="magic-checkbox fl" type="checkbox" value="2" name="status[]" <%= !@status.blank? && @status.include?('2') ? 'checked' : '' %>> <input id="work_status_3" class="magic-checkbox fl" type="checkbox" value="2" name="status[]" <%= !@status.blank? && @status.include?('2') ? 'checked' : '' %>>
<label for="work_status_3" class="fl mr25">延时提交(<%= student_works.where(:work_status => 2).count %>)</label> <label for="work_status_3" class="fl mr25">延时提交(<%= student_works.where(:work_status => 2).size %>)</label>
</li> </li>
<li class="clearfix"> <li class="clearfix">
<span class="fl mr10 color-grey-8">分班情况:</span> <span class="fl mr10 color-grey-8">分班情况:</span>
@ -210,9 +210,9 @@
<a href="javascript:void(0);" id="group_no_limit" class="<%= @group.blank? ? 'check_on' : '' %> pl10 pr10">不限</a> <a href="javascript:void(0);" id="group_no_limit" class="<%= @group.blank? ? 'check_on' : '' %> pl10 pr10">不限</a>
</span> </span>
<p class="fl pb10" style="display: block;max-width: 995px;"> <p class="fl pb10" style="display: block;max-width: 995px;">
<% groups.each do |group| %> <% groups.includes(:members).each do |group| %>
<input id="group_<%= group.id %>" class="magic-checkbox fl" type="checkbox" value="<%= group.id %>" name="group[]" <%= !@group.blank? && @group.include?(group.id) ? 'checked' : '' %>> <input id="group_<%= group.id %>" class="magic-checkbox fl" type="checkbox" value="<%= group.id %>" name="group[]" <%= !@group.blank? && @group.include?(group.id) ? 'checked' : '' %>>
<label for="group_<%= group.id %>" class="fl mr25"><%= group.name %>(<%= group.members.count %>)</label> <label for="group_<%= group.id %>" class="fl mr25"><%= group.name %>(<%= group.members.size %>)</label>
<% end %> <% end %>
<% if !@group_teacher %> <% if !@group_teacher %>
<input id="group_0" class="magic-checkbox fl" type="checkbox" value="0" name="group[]"> <input id="group_0" class="magic-checkbox fl" type="checkbox" value="0" name="group[]">
@ -255,7 +255,7 @@
<% my_work = cur_user_works_for_homework @homework %> <% my_work = cur_user_works_for_homework @homework %>
<% if @homework.homework_detail_manual.comment_status == 3 %> <% if @homework.homework_detail_manual.comment_status == 3 %>
<% unless my_work.nil? %> <% unless my_work.nil? %>
<% if my_work.user.student_works_evaluation_distributions.where(:student_work_id => @homework.student_works.map(&:id)).count != 0 %> <% if my_work.user.student_works_evaluation_distributions.where(:student_work_id => @homework.student_works.map(&:id)).size != 0 %>
<span class="edu-filter-btn edu-filter-btn-orange mb15">你在匿评开启之前提交了作品,你的作品正在匿评中</span> <span class="edu-filter-btn edu-filter-btn-orange mb15">你在匿评开启之前提交了作品,你的作品正在匿评中</span>
<% else %> <% else %>
<span class="edu-filter-btn edu-filter-btn-orange mb15">你在匿评开启之后才提交作品,你的作品没有参与匿评</span> <span class="edu-filter-btn edu-filter-btn-orange mb15">你在匿评开启之后才提交作品,你的作品没有参与匿评</span>
@ -278,8 +278,8 @@
<% end %> <% end %>
<p class="color-grey-8 font-12 clearfix mb15"> <p class="color-grey-8 font-12 clearfix mb15">
<span class=""><%= @homework.student_works.where("work_status != 0").count %> 已交</span> <span class=""><%= @homework.student_works.where("work_status != 0").size %> 已交</span>
<span class="ml30"><%= @homework.course.student.count - @homework.student_works.where("work_status != 0").size %> <span class="ml30"><%= @homework.course.student.size - @homework.student_works.where("work_status != 0").size %>
未交</span> 未交</span>
<% if @homework.homework_detail_manual %> <% if @homework.homework_detail_manual %>
<% if @homework.homework_detail_manual.comment_status == 1 %> <% if @homework.homework_detail_manual.comment_status == 1 %>

@ -37,7 +37,7 @@
<% if comment_status == 0 || activity.homework_group_settings.where("publish_time is null or publish_time > '#{Time.now}'").count > 0 %> <% 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> <li><%= link_to '立即发布', publish_notice_homework_common_path(activity), :remote => true %></li>
<% end %> <% 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 %> <% if (comment_status == 1 && activity.end_time && 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> <li><%= link_to '立即截止', end_notice_homework_common_path(activity), :remote => true %></li>
<% end %> <% end %>
<li><%= link_to "导出成绩", student_work_index_path(:homework => activity, :format => 'xls'), :id => "export_student_work" %></li> <li><%= link_to "导出成绩", student_work_index_path(:homework => activity, :format => 'xls'), :id => "export_student_work" %></li>

Loading…
Cancel
Save