解决冲突

dev_ec
daiao 6 years ago
commit ed4a3711b7

@ -31,9 +31,9 @@ class CollegesController < ApplicationController
end
def verification_school_identifier
school = School.where(:identifier => params[:identifier]).first
status = school.present? ? 1 : 0
render :json => {status: status}
schools = School.where(identifier: params[:identifier])
schools = schools.where('id != ?', params[:school_id]) if params[:school_id].present?
render :json => { status: schools.exists? ? 1 : 0 }
end
def online_school

@ -4,8 +4,8 @@ class Managements::SchoolsController < Managements::BaseController
def statistics
@sub_type = 1
params[:sort_by] = :teacher_count if params[:sort_by].blank?
params[:sort_direction] = :desc if params[:sort_direction].blank?
params[:sort_by] = params[:sort_by].presence || :teacher_count
params[:sort_direction] = params[:sort_direction].presence || :desc
service = Management::SchoolReportService.new(params)
@obj_count, @schools = service.call
@ -20,8 +20,8 @@ class Managements::SchoolsController < Managements::BaseController
def data_grow
@sub_type = 2
params[:data_type] ||= 'grow'
params[:sort_by] = :teacher_increase_count if params[:sort_by].blank?
params[:sort_direction] = :desc if params[:sort_direction].blank?
params[:sort_by] = params[:sort_by].presence || :teacher_increase_count
params[:sort_direction] = params[:sort_direction].presence || :desc
service = Management::SchoolDataGrowService.new(params)
@grow_summary = service.grow_summary
@ -31,7 +31,7 @@ class Managements::SchoolsController < Managements::BaseController
end
def data_contrast
params[:contrast_column] = :teacher_increase_count if params[:contrast_column].blank?
params[:contrast_column] = params[:contrast_column].presence || :teacher_increase_count
params[:sort_direction] ||= :desc
params[:sort_by] = :percentage

@ -875,7 +875,7 @@ class ManagementsController < ApplicationController
keyword = params[:keyword]
limit = 20
if search
if search.present?
if "u_name" == keyword
@evaluate_recods = EvaluateRecord.joins("join users u on evaluate_records.user_id = u.id").where("concat(u.lastname, u.firstname) like '%#{search}%'")
# @evaluate_recods = EvaluateRecord.where(user_id: User.where("concat(lastname, firstname) like '%#{search}%'").pluck(:id))
@ -884,7 +884,12 @@ class ManagementsController < ApplicationController
# @evaluate_recods = EvaluateRecord.where(user_id: UserExtensions.where(school_id: School.where("name like '%#{search}%'").pluck(:id)).pluck(:user_id))
end
else
@evaluate_recods = EvaluateRecord.where("0=0")
@evaluate_recods = EvaluateRecord.where(nil)
end
if params[:beginTime].present?
endTime = params[:endTime].present? ? params[:endTime] : Time.now
@evaluate_recods = @evaluate_recods.where("created_at >= ? and created_at <= ?", params[:beginTime], endTime)
end
@evaluate_recods_count = @evaluate_recods.count
@ -1513,7 +1518,7 @@ end
if search.blank?
@schools = School.where("0=0")
else
@schools = School.where("name like '%#{search}%'")
@schools = School.where("name like ?", "%#{search}%")
end
if params[:index] == '8'
@schools = @schools.reorder("created_at #{@sx_order}")

@ -500,6 +500,15 @@ class Course < ActiveRecord::Base
end
end
# 课堂实训作业的评测次数
def evaluate_count
course_user_ids = self.members.map(&:user_id)
shixun_ids = self.homework_commons.joins(:homework_commons_shixuns).where(homework_type: 4).pluck(:shixun_id)
return 0 if shixun_ids.blank?
Game.joins(:challenge).where(challenges: {shixun_id: shixun_ids}, games: {user_id: course_user_ids}).sum(:evaluate_count)
end
#课程动态公共表记录
def act_as_course_activity
self.course_acts << CourseActivity.new(:user_id => self.tea_id,:course_id => self.id)

@ -49,8 +49,9 @@
<%= javascript_include_tag 'attachments' %>
<style>
.ui-widget-content{
height: 16px;
width: 200px;
/*height: 16px;*/
/*width: 200px;*/
top: 320px !important;
float: left;
margin: 5px 10px 0px 10px;
}

@ -9,6 +9,7 @@
<th width="6%">普通作业</th>
<th width="5%">实训作业</th>
<th width="4%">试卷</th>
<th width="6%">评测次数</th>
<th width="4%">私有</th>
<th width="7%">状态</th>
<th width="8%" class="edu-txt-left">创建者单位</th>
@ -28,6 +29,7 @@
<td><%= course.homework_commons.where(:homework_type => 1).count %></td>
<td><%= course.homework_commons.where(:homework_type => 4).count %></td>
<td><%= course.exercises.count %></td>
<td><%= course.evaluate_count %></td>
<td><%= course.is_public.to_i == 1 ? '--' : '√' %></td>
<td><%= course.is_end ? "已结束" : "正在进行" %></td>
<td class="edu-txt-left"><%= course.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : course.teacher.try(:user_extensions).try(:school) %></td>

@ -16,13 +16,14 @@
<th width="12%">开始时间<i class="fa fa-long-arrow-down color-light-green ml5" ></i></th>
<th width="12%">结束时间</th>
<th width="8%">耗时</th>
<th width="10%">评测者</th>
<th width="8%">最大执行时间</th>
<th width="8%">评测者</th>
<th width="10%">评测者单位</th>
<th width="5%">耗时详细</th>
</tr>
</thead>
<tbody>
<% @evaluate_recods.each do |record| %>
<% @evaluate_recods.includes(:shixun).each do |record| %>
<tr>
<td><%= record.id %></td>
<td><a href="/tasks/<%= record.game.try(:identifier) %>" target="_blank"><%= record.game.try(:identifier) %></a></td>
@ -33,6 +34,7 @@
<td><%= record.created_at.strftime('%Y-%m-%d %H:%M:%S') %></td>
<td><%= record.updated_at.strftime('%Y-%m-%d %H:%M:%S') %></td>
<td><%= record.try(:consume_time) %></td>
<td><%= record.shixun.exec_time %></td>
<td class="task-hide" title="<%= record.user.show_real_name %>">
<%= link_to record.user.show_real_name, user_path(record.user), :target => "_blank" %>
</td>

@ -1,14 +1,21 @@
<div class="edu-class-container">
<%= form_tag(url_for(evaluate_records_managements_path),:id=>"evaluate_records",:method => "post",:remote=>true) do %>
<div class="edu-con-top clearfix xmt10">
<div class="edu-con-top clearfix mb20 bor-grey-e mt10">
<select class="fl task-form-15 task-height-30" style="margin:20px 0px 10px 25px;width: 11%" name="keyword" id="condition">
<option value="u_name">评测者姓名搜索</option>
<option value="s_name">评测者单位搜索</option>
</select>
<input class="fl task-form-20 task-height-30 mt20 ml20" name="search" maxlength="40" placeholder="输入关键字进行搜索" type="text" id="Look_name">
<li class="fl mt20">
<span class="mr10 ml10 font-14">开始时间</span>
<input type="text" name="beginTime" placeholder="请选择开始时间" class="winput-150-30 mr10"/>
<input type="text" name="endTime" placeholder="请选择结束时间" class="winput-150-30"/>
</li>
<a href="javascript:void(0);" class="fl task-btn task-btn-orange ml5 mt20" onclick="$('#evaluate_records').submit();">搜索</a>
<a href="javascript:clearSearchCondition()" class="fl task-btn ml5 mt2 mt20" id="clear_contents">清除</a>
</div>
<% end %>
</div>
<div class="edu-con-bg01 mt15" id="evaluate_records_list">
<%= render :partial => "evaluate_records_list" %>
</div>
@ -19,4 +26,17 @@
$("#Look_name").val("");
$.get('<%= evaluate_records_managements_path() %>');
}
$("input[name='beginTime']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
$("input[name='endTime']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
</script>

@ -35,12 +35,13 @@
<th width="5%">文件更新</th>
<th width="10%">中间层总耗时<i class="fa fa-long-arrow-down color-light-green ml5" ></i></th>
<th width="5%">pull代码</th>
<th width="5%">pod启动</th>
<th width="5%">pod执行</th>
<th width="10%">pod启动</th>
<th width="10%">pod执行</th>
<th width="10%">中间层回传</th>
<th width="5%">前端轮询</th>
<th width="10%">前端轮询</th>
<th width="10%">回调结果存储</th>
<th width="25%">实训详情</th>
<th width="5%">创建时间</th>
<th width="10%">实训详情</th>
</tr>
</thead>
<tbody>
@ -58,7 +59,8 @@
<td><%= record.return_back %></td>
<td><%= record.front_js %></td>
<td><%= record.test_cases %></td>
<td><%= link_to record.game.challenge.try(:subject), task_path(record.game), :target => "_blank" %></td>
<td><%= record.created_at %></td>
<td><%= link_to record.game.try(:identifier), task_path(record.game), :target => "_blank" %></td>
</tr>
<% end %>
</tbody>

@ -130,7 +130,10 @@
if($("#unit_head_route").val().trim() !=""){
$.ajax({
url: "<%= verification_school_identifier_colleges_path %>",
data: {identifier: $("#unit_head_route").val().trim()},
data: {
school_id: <%= @school.id %>,
identifier: $("#unit_head_route").val().trim()
},
async:false,
success: function (data) {
if(data.status == 0){

Loading…
Cancel
Save