Merge branches 'dev_aliyun' and 'dev_new_shixunsrepository' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_new_shixunsrepository

dev_new_shixunsrepository
杨树明 5 years ago
commit e7bd084bf5

@ -691,7 +691,7 @@ class GamesController < ApplicationController
next_game: next_game&.identifier}
rescue Exception => e
uid_logger("choose build failed #{e.message}")
@result = [status: -1, contents: "#{e.message}"]
tip_exception(-1, e.message)
end
# 轮询获取状态

@ -87,16 +87,16 @@ class HomeworkCommonsController < ApplicationController
end
@task_count = @homework_commons.size
order_str = @homework_type == 4 ? "position DESC" : "IF(ISNULL(homework_commons.publish_time),0,1), homework_commons.publish_time DESC,
order_str = @homework_type == 4 ? "homework_commons.position DESC" : "IF(ISNULL(homework_commons.publish_time),0,1), homework_commons.publish_time DESC,
homework_commons.created_at DESC"
@homework_commons = @homework_commons.order(order_str).page(page).per(15)
if @homework_type == 4
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :shixuns)
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_group_settings, :shixuns, :course_second_category, user: :user_extension)
elsif @homework_type == 3
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_detail_group)
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_group_settings, :homework_detail_group, :course_second_category, user: :user_extension)
else
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings)
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_group_settings, :course_second_category, user: :user_extension)
end
end
@ -902,7 +902,8 @@ class HomeworkCommonsController < ApplicationController
def publish_groups
@current_user = current_user
if @homework.publish_immediately @current_user
charge_ids = @course.charge_group_ids(@current_user)
if @homework.publish_immediately charge_ids
# 可立即发布的分班:当前用户管理的分班去除已发布的分班
group_ids = @course.charge_group_ids(@current_user) - @homework.homework_group_settings.group_published.pluck(:course_group_id)
@course_groups = @course.course_groups.where(id: group_ids)
@ -1031,7 +1032,8 @@ class HomeworkCommonsController < ApplicationController
def end_groups
@current_user = current_user
if @homework.end_immediately @current_user
charge_ids = @course.charge_group_ids(@current_user)
if @homework.end_immediately charge_ids
# 可立即截止的分班:统一设置则是用户管理的所有分班,否则是当前用户管理的分班中已发布且未截止的
charge_group_ids = @course.charge_group_ids(@current_user) # 当前用户管理的分班
group_ids = @homework.unified_setting ? charge_group_ids :
@ -1313,7 +1315,7 @@ class HomeworkCommonsController < ApplicationController
# 最新一次的查重时间
@last_review_time = format_time @homework.homework_group_reviews.last.try(:created_at)
@charge_ids = @course.charge_group_ids(@current_user)
end
# 代码查重代码的详情

@ -42,6 +42,14 @@ module CoursesHelper
end
end
def practice_homework_count course
homeworks = course.homework_commons.practices
publish_count = homeworks.select{|homework| homework.publish_time.present? && homework.publish_time <= Time.now}.size
unpublish_count = homeworks.select{|homework| homework.publish_time.nil? || homework.publish_time > Time.now}.size
all_count = homeworks.size
{publish_count: publish_count, unpublish_count: unpublish_count, all_count: all_count}
end
# 课堂模块的url
def module_url mod, course
return nil if mod.blank? or course.blank?

@ -183,7 +183,7 @@ module HomeworkCommonsHelper
student_works = homework_common.teacher_works(member)
count[:commit_count] = student_works.select{|work| work.work_status != 0 }.size
count[:uncommit_count] = student_works.select{|work| work.work_status == 0 }.size
count[:compelete_count] = Myshixun.where(id: student_works.pluck(:myshixun_id).reject(&:blank?), status: 1).size
count[:compelete_count] = Myshixun.where(id: student_works.pluck(:myshixun_id).reject{|ms| ms==0}, status: 1).size
count[:all_count] = student_works.size
count
end

@ -257,7 +257,7 @@ class Course < ApplicationRecord
# 老师负责的分班id
def charge_group_ids user
member = course_member(user.id)
member = user.is_a?(CourseMember) ? user : course_member(user.id)
group_ids = if member.present?
member.teacher_course_groups.size > 0 ? member.teacher_course_groups.pluck(:course_group_id) : course_groups.pluck(:id)
elsif user.admin_or_business?

@ -141,15 +141,17 @@ class HomeworkCommon < ApplicationRecord
end
# 作业能否立即发布
def publish_immediately user
homework_detail_manual.try(:comment_status) == 0 || homework_group_settings.where(course_group_id: course.charge_group_ids(user)).
none_published.count > 0
def publish_immediately charge_ids
homework_detail_manual.try(:comment_status) == 0 ||
homework_group_settings.select{|setting| charge_ids.include?(setting.course_group_id) &&
(setting.publish_time.nil? || setting.publish_time > Time.now)}.size > 0
end
# 作业能否立即截止
def end_immediately user
(unified_setting && homework_detail_manual.try(:comment_status) == 1 && end_time > Time.now) || homework_group_settings.
where(course_group_id: course.charge_group_ids(user)).published_no_end.count > 0
def end_immediately charge_ids
(unified_setting && homework_detail_manual.try(:comment_status) == 1 && end_time.present? && end_time > Time.now) ||
homework_group_settings.select{|setting| charge_ids.include?(setting.course_group_id) &&
!setting.publish_time.nil? && setting.publish_time < Time.now && setting.end_time > Time.now}.size > 0
end
# 学生是否提交了作品

@ -1,5 +1,5 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb("#{@salesman.name}的渠道", admins_salesmans_path) %>
<% add_admin_breadcrumb("#{@salesman.name}跟踪的院校", admins_salesmans_path) %>
<% end %>
<% define_admin_breadcrumbs do %>
@ -18,13 +18,13 @@
</div>
</div>
<%= text_field_tag :keyword, params[:keyword], placeholder: 'ID/单位名称检索', class: 'form-control mx-3 search-input' %>
<%= text_field_tag :keyword, params[:keyword], placeholder: 'ID/院校名称检索', class: 'form-control mx-3 search-input' %>
<%= javascript_void_link '搜索', class: 'btn btn-primary search-btn', target: '' %>
<input type="reset" class="btn btn-secondary clear-btn ml-3" value="清空"/>
</form>
<div class="flex-12">
<%= javascript_void_link '新增渠道', class: 'btn btn-primary', data: {toggle: 'modal', target: '.admin-add-salesman-channel-user-modal' } %>
<%= javascript_void_link '新增院校', class: 'btn btn-primary', data: {toggle: 'modal', target: '.admin-add-salesman-channel-user-modal' } %>
</div>
</div>

@ -2,7 +2,7 @@
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">添加渠道</h5>
<h5 class="modal-title">添加院校</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>

@ -1,10 +1,10 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb("#{@salesman.name}的客户", admins_salesmans_path) %>
<% add_admin_breadcrumb("#{@salesman.name}跟踪的用户", admins_salesmans_path) %>
<% end %>
<div class="box search-form-container salesman-customer-list-form rig">
<div class="flex-1">
<%= javascript_void_link '新增户', class: 'btn btn-primary', data: {salesman_id: @salesman.id, toggle: 'modal', target: '.admin-add-salesman-customer-user-modal' } %>
<%= javascript_void_link '新增户', class: 'btn btn-primary', data: {salesman_id: @salesman.id, toggle: 'modal', target: '.admin-add-salesman-customer-user-modal' } %>
</div>
</div>

@ -2,7 +2,7 @@
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">添加户</h5>
<h5 class="modal-title">添加户</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>

@ -3,8 +3,8 @@
<tr>
<th width="6%">序号</th>
<th width="20%" class="text-left">业务员</th>
<th width="30%" class="text-left">重点跟踪客户(点击数字客户列表)</th>
<th width="30%" class="text-left">重点跟踪院校(点击数字渠道列表)</th>
<th width="30%" class="text-left">重点用户跟踪(点击数字进入列表)</th>
<th width="30%" class="text-left">重点院校跟踪(点击数字进入列表)</th>
<th width="14%">操作</th>
</tr>
</thead>
@ -14,15 +14,15 @@
<tr class="salesman-item salesman-item-<%= salesman.id %>">
<td><%= index + 1 %></td>
<td class="text-left">
<span><%= link_to salesman.name, admins_salesman_path(salesman), :title => salesman.name %></span>
<span><%= link_to salesman.name, users_path(salesman), :title => salesman.name %></span>
</td>
<td class="text-left">
<span><%= link_to salesman.salesman_customers_count.to_i,
admins_salesman_customers_path(salesman_id: salesman), :title => "点击进入户列表" %></span>
admins_salesman_customers_path(salesman_id: salesman), :title => "点击进入户列表" %></span>
</td>
<td class="text-left">
<span><%= link_to salesman.salesman_channels_count.to_i, admins_salesman_channels_path(salesman_id: salesman),
:title => "点击进入渠道列表" %></span>
:title => "点击进入院校列表" %></span>
</td>
<td>
<%= delete_link '删除', admins_salesman_path(salesman, element: ".salesman-item-#{salesman.id}"),

@ -1,5 +1,6 @@
# 教师身份的立即发布、立即截止、代码查重入口的判断
json.publish_immediately identity < Course::STUDENT && homework.publish_immediately(user)
json.end_immediately identity < Course::STUDENT && homework.end_immediately(user)
charge_ids = homework.course.charge_group_ids(user)
json.publish_immediately identity < Course::STUDENT && homework.publish_immediately(charge_ids)
json.end_immediately identity < Course::STUDENT && homework.end_immediately(charge_ids)
json.code_review identity < Course::STUDENT && homework.code_review if homework.homework_type == 'practice'
json.view_answer homework.view_answer(identity, user.id) if homework.homework_type != "practice"

@ -1,6 +1,10 @@
json.main_category main_catrgory do |category|
json.main_category_id 0
json.main_category_name category.module_name
homework_count = practice_homework_count category.course
json.publish_count homework_count[:publish_count]
json.unpublish_count homework_count[:unpublish_count]
json.all_count homework_count[:all_count]
end
json.homework_category homework_category do |category|
json.category_id category.id

@ -1,7 +1,9 @@
json.partial! "homework_public_navigation", locals: {homework: @homework, course: @course, user: @current_user}
json.last_review_time @last_review_time
json.publish_immediately @user_course_identity < Course::STUDENT && @homework.publish_immediately(@current_user)
json.end_immediately @user_course_identity < Course::STUDENT && @homework.end_immediately(@current_user)
json.publish_immediately @user_course_identity < Course::STUDENT && @homework.publish_immediately(@charge_ids)
json.end_immediately @user_course_identity < Course::STUDENT && @homework.end_immediately(@charge_ids)
# 分班情况
json.group_info do

@ -24,6 +24,10 @@ json.homeworks @homework_commons.each do |homework|
# 只有在主目录才显示
json.upper_category_name homework.course_second_category&.name unless params[:category]
charge_ids = @course.charge_group_ids(@member)
json.publish_immediately @user_course_identity < Course::STUDENT && homework.publish_immediately(charge_ids)
json.end_immediately @user_course_identity < Course::STUDENT && homework.end_immediately(charge_ids)
unless curr_status[:status].include?("未发布")
work_count = calculate_work_count homework, @member
json.commit_count work_count[:commit_count]

@ -404,7 +404,8 @@ class CommonWorkList extends Component{
category: {},
b_order: 'desc',
searchtypes:false,
loadingstate:false
loadingstate:false,
comwbool:false
}
}
onTablePagination = (page) => {
@ -476,6 +477,16 @@ class CommonWorkList extends Component{
this.fetchList()
}
fetchList = () => {
if(this.state.comwbool===true){
console.log('arg_course_group2');
console.log(this.state.arg_course_group);
return
}
this.setState({
comwbool:true,
})
//分班
let workId=this.props.match.params.workId;
let courseId=this.props.match.params.coursesId;
@ -493,12 +504,23 @@ class CommonWorkList extends Component{
moduleName: '作品列表'
}))
}
}).catch((error)=>{
setTimeout(() => {
this.setState({
comwbool:false,
})
}, 1000)
}).catch((error)=>{
console.log(error)
this.setState({
isSpin:false,
loadingstate:false
})
setTimeout(() => {
this.setState({
comwbool:false,
})
}, 1000)
})
@ -514,6 +536,7 @@ class CommonWorkList extends Component{
})
}
courseGroupOptionChange = (values, isAllChecked) => {
this.setState({arg_course_group: isAllChecked ? [] : values, page: 1}, () => {
this.fetchList()
})
@ -792,10 +815,10 @@ class CommonWorkList extends Component{
<div style={{ background: '#fff'}} className="workListContent">
{ isAdmin && hasData && <ul className="clearfix" style={{padding: "20px 40px 10px", position: 'relative', paddingLeft: '24px'}}>
<CheckAllGroup options={options_teacher_comment} label={'你的评阅:'} onChange={this.teacherCommentOptionChange}></CheckAllGroup>
<CheckAllGroup options={options_status} label={'作品状态:'} onChange={this.statusOptionChange}></CheckAllGroup>
{isGroup && <CheckAllGroup options={options_member_work} label={'组内角色:'} onChange={this.memberWorkChange}></CheckAllGroup>}
{options_course_group.length > 1 && <CheckAllGroup options={options_course_group} label={'分班情况:'} onChange={this.courseGroupOptionChange} checkboxGroupStyle={{width: '980px'}}></CheckAllGroup>}
<CheckAllGroup comwbool={this.state.comwbool} options={options_teacher_comment} label={'你的评阅:'} onChange={this.teacherCommentOptionChange}></CheckAllGroup>
<CheckAllGroup comwbool={this.state.comwbool} options={options_status} label={'作品状态:'} onChange={this.statusOptionChange}></CheckAllGroup>
{isGroup && <CheckAllGroup comwbool={this.state.comwbool} options={options_member_work} label={'组内角色:'} onChange={this.memberWorkChange}></CheckAllGroup>}
{options_course_group.length > 1 && <CheckAllGroup comwbool={this.state.comwbool} options={options_course_group} label={'分班情况:'} onChange={this.courseGroupOptionChange} checkboxGroupStyle={{width: '980px'}}></CheckAllGroup>}
{/* value={search} */}

@ -1,62 +1,69 @@
import React,{ Component } from "react";
import { WordsBtn } from "educoder";
import { Checkbox } from 'antd'
const CheckboxGroup = Checkbox.Group;
class CheckAllGroup extends Component{
constructor(props){
super(props);
this.state = {
checkAll: true,
checkedValues: []
}
}
onCheckAll = () => {
this.setState({
'checkAll': true,
checkedValues: []
})
this.props.onChange && this.props.onChange([], true);
}
onChange = (checkedValues) => {
if (checkedValues.length > 0) {
this.setState({
'checkAll': false,
checkedValues
})
this.props.onChange && this.props.onChange(checkedValues, false)
} else {
this.setState({
'checkAll': true,
checkedValues: []
})
this.props.onChange && this.props.onChange(checkedValues, true);
}
console.log(checkedValues, arguments)
}
render() {
let { label, options, checkboxGroupStyle }=this.props;
const { checkAll, checkedValues } = this.state;
return (
<li className="clearfix">
<style>{`
.groupList .ant-checkbox-group-item{
margin-bottom:5px;
}
`}</style>
<span className="fl mr10 color-grey-8">{label}</span>
<span className="fl mr25">
<a href="javascript:void(0);" id="comment_no_limit" className={`pl10 pr10 ${checkAll ? 'check_on' : ''}`} onClick={this.onCheckAll}>全部</a>
</span>
<div className="fl groupList" style={{maxWidth:"990px"}}>
{
options.length > 1 && <CheckboxGroup options={options} onChange={this.onChange} value={checkedValues} style={checkboxGroupStyle}/>
}
</div>
</li>
)
}
}
export default CheckAllGroup;
import React,{ Component } from "react";
import { WordsBtn } from "educoder";
import { Checkbox } from 'antd'
const CheckboxGroup = Checkbox.Group;
class CheckAllGroup extends Component{
constructor(props){
super(props);
this.state = {
checkAll: true,
checkedValues: []
}
}
onCheckAll = () => {
this.setState({
'checkAll': true,
checkedValues: []
})
this.props.onChange && this.props.onChange([], true);
}
onChange = (checkedValues) => {
try {
if(this.props.comwbool===true){
return
}
}catch (e) {
}
if (checkedValues.length > 0) {
this.setState({
'checkAll': false,
checkedValues
})
this.props.onChange && this.props.onChange(checkedValues, false)
} else {
this.setState({
'checkAll': true,
checkedValues: []
})
this.props.onChange && this.props.onChange(checkedValues, true);
}
console.log(checkedValues, arguments)
}
render() {
let { label, options, checkboxGroupStyle }=this.props;
const { checkAll, checkedValues } = this.state;
return (
<li className="clearfix">
<style>{`
.groupList .ant-checkbox-group-item{
margin-bottom:5px;
}
`}</style>
<span className="fl mr10 color-grey-8">{label}</span>
<span className="fl mr25">
<a href="javascript:void(0);" id="comment_no_limit" className={`pl10 pr10 ${checkAll ? 'check_on' : ''}`} onClick={this.onCheckAll}>全部</a>
</span>
<div className="fl groupList" style={{maxWidth:"990px"}}>
{
options.length > 1 && <CheckboxGroup options={options} onChange={this.onChange} value={checkedValues} style={checkboxGroupStyle}/>
}
</div>
</li>
)
}
}
export default CheckAllGroup;

Loading…
Cancel
Save