Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_hs
hjm 5 years ago
commit ceeaa83769

@ -438,7 +438,7 @@ module ApplicationHelper
content_tag(:span, text, opts)
end
def sort_tag(content, opts)
def sort_tag(content = '', **opts)
options = {}
options[:sort_by] = opts.delete(:name)
is_current_sort = params[:sort_by].to_s == options[:sort_by]
@ -450,10 +450,13 @@ module ApplicationHelper
when 'asc' then 'fa-sort-amount-asc'
else ''
end
opts[:style] = "#{opts[:style]} ;position: relative;"
content_tag(:span, opts) do
link_to path, remote: true do
content += content_tag(:i, '', class: "fa color-light-green ml-1 #{arrow_class}") if is_current_sort
content = content_tag(:span) { yield } if block_given?
content += content_tag(:i, '', class: "fa color-light-green ml-1 #{arrow_class}", style: 'position: absolute;top:0;') if is_current_sort
raw content
end
end

@ -269,6 +269,6 @@ module CoursesHelper
myshixun = Myshixun.where(user_id: user_id, shixun_id: subject&.shixuns).order("updated_at desc").first
return "" unless myshixun
stage_shixun = subject&.stage_shixuns.where(shixun_id: myshixun.shixun_id).take
progress = stage_shixun&.position.to_s + "-" + stage_shixun&.position.to_s + " " + myshixun.shixun&.name
progress = stage_shixun&.stage&.position.to_s + "-" + stage_shixun&.position.to_s + " " + myshixun.shixun&.name
end
end

@ -1,19 +1,21 @@
<table class="table table-hover daily-school-statistic-list-table">
<thead class="thead-light">
<tr>
<th width="14%" class="text-left">单位名称</th>
<th width="12%" class="text-left">单位名称</th>
<th width="10%"><%= sort_tag('教师总数', name: 'teacher_count', path: admins_daily_school_statistics_path) %></th>
<th width="10%"><%= sort_tag('学生总数', name: 'student_count', path: admins_daily_school_statistics_path) %></th>
<th width="10%"><%= sort_tag('课堂总数', name: 'course_count', path: admins_daily_school_statistics_path) %></th>
<th width="14%"><%= sort_tag('正在进行课堂数', name: 'active_course_count', path: admins_daily_school_statistics_path) %></th>
<th width="10%"><%= sort_tag('实训总数', name: 'shixun_count', path: admins_daily_school_statistics_path) %></th>
<th width="12%">
<%= sort_tag('实训评测总数', name: 'shixun_evaluate_count', path: admins_daily_school_statistics_path) %>
<i class="fa fa-question-circle" data-toggle="tooltip" data-html="true" data-placement="top" title="数据更新时间为<br/>当日6点、12点、18点、24点"></i>
<th width="13%">
<%= sort_tag(name: 'shixun_evaluate_count', path: admins_daily_school_statistics_path) do %>
实训评测总数
<i class="fa fa-question-circle" data-toggle="tooltip" data-html="true" data-placement="top" title="数据更新时间为<br/>当日6点、12点、18点、24点"></i>
<% end %>
</th>
<th width="10%"><%= sort_tag('实训作业总数', name: 'homework_count', path: admins_daily_school_statistics_path) %></th>
<th width="10%"><%= sort_tag('其它作业总数', name: 'other_homework_count', path: admins_daily_school_statistics_path) %></th>
<th width="11%"><%= sort_tag('实训作业总数', name: 'homework_count', path: admins_daily_school_statistics_path) %></th>
<th width="11%"><%= sort_tag('其它作业总数', name: 'other_homework_count', path: admins_daily_school_statistics_path) %></th>
<th width="13%"><%= sort_tag('动态时间', name: 'nearly_course_time', path: admins_daily_school_statistics_path) %></th>
</tr>
</thead>

@ -2,9 +2,10 @@
namespace :sync do
task :public_message => :environment do
subject_id = ENV['args'].split(",")[0] # 对应课程的id
board_id = ENV['args'].split(",")[1]
message_id = ENV['args'].split(",")[2]
status = ENV['args'].split(",")[3] # 表示相应的期数
shixun_id = ENV['args'].split(",")[1] # 对应课程的id
board_id = ENV['args'].split(",")[2]
message_id = ENV['args'].split(",")[3]
status = ENV['args'].split(",")[4] # 表示相应的期数
if status.to_i == 1
start_time = '2018-12-16'
@ -21,7 +22,6 @@ namespace :sync do
shixun_ids = Shixun.find_by_sql("select shixun_id from stage_shixuns where stage_id in (select id from stages where
subject_id=#{subject_id}) ").map(&:shixun_id)
discusses = Discuss.where(dis_id: shixun_ids).where("created_at >? and created_at <?", start_time, end_time)
if discusses.present?
discusses.find_each do |discuss|
@ -35,10 +35,11 @@ namespace :sync do
end
task :sigle_message => :environment do
shixun_id = ENV['args'].split(",")[0] # 对应课程的id
board_id = ENV['args'].split(",")[1]
message_id = ENV['args'].split(",")[2]
status = ENV['args'].split(",")[3] # 表示相应的期数
subject_id = ENV['args'].split(",")[0] # 对应课程的id
shixun_id = ENV['args'].split(",")[1] # 对应课程的id
board_id = ENV['args'].split(",")[2]
message_id = ENV['args'].split(",")[3]
status = ENV['args'].split(",")[4] # 表示相应的期数
if status.to_i == 1
start_time = '2018-12-16'
@ -52,21 +53,69 @@ namespace :sync do
end_time = '2022-07-28'
end
discusses = Discuss.where(dis_id: shixun_id).where("parent_id is null and created_at >? and created_at <?", start_time, end_time)
if subject_id.to_i == -1
discusses = Shixun.where("parent_id is null and dis_id=?", shixun_id)
else
shixun_ids = Shixun.find_by_sql("select shixun_id from stage_shixuns where stage_id in (select id from stages where
subject_id=#{subject_id}) ").map(&:shixun_id)
discusses = Discuss.where("parent_id is null and dis_id=?", shixun_ids)
end
discusses.each do |discuss|
rand_created_on = random_time start_time, end_time
puts discuss.id
# 找到所有的子回复
replies = Discuss.where(parent_id: discuss.id)
# 如果有子回复,除了创建父回复外,还需要同步子回复
new_message = Message.create!(board_id: board_id.to_i, author_id: discuss.user_id, parent_id: message_id, root_id: message_id)
MessageDetail.create!(message_id: new_message.id, content: discuss.try(:content))
new_message.update_columns(created_on: rand_created_on, updated_on: rand_created_on)
message_detail = MessageDetail.create!(message_id: new_message.id, content: discuss.try(:content))
message_detail.update_columns(created_at: rand_created_on, updated_at: rand_created_on)
if replies.present?
replies.each do |reply|
puts("reply id si #{reply.id}")
reply_time = random_time(start_time, end_time)
while reply_time > rand_created_on
reply_time = random_time(start_time, end_time)
end
reply_message = Message.create!(board_id: board_id.to_i, author_id: reply.user_id, parent_id: new_message.id, root_id: message_id)
MessageDetail.create!(message_id: reply_message.id, content: reply.try(:content))
reply_message.update_columns(created_on: reply_time, updated_on: reply_time)
reply_message_detail = MessageDetail.create!(message_id: reply_message.id, content: reply.try(:content))
reply_message_detail.update_columns(created_at: rand_created_on, updated_at: rand_created_on)
end
end
end
def min_swith(time)
puts time
return time < 9 ? "0#{time}" : time
end
def random_time(start_time, end_time)
hour = (6..23).to_a.sample(1).first
min = rand(60)
sec = rand(60)
start_time = Date.parse(start_time)
end_time = Date.parse(end_time)
date = (start_time..end_time).to_a.sample(1).first
time = "#{date} #{min_swith(hour)}:#{min_swith(min)}:#{min_swith(sec)}"
puts time
time
end
# 子评论的时间必须小于父评论
def smaller_time(parent_time, start_time, end_time)
large_time = random_time(start_time, end_time)
while large_time > parent_time
large_time = random_time(start_time, end_time)
end
large_time
end
end
end

@ -1,6 +1,7 @@
import React, { Component } from 'react';
import { Modal} from 'antd';
import axios from 'axios';
import Modals from './Modals';
//加入精品课堂
class Jointheclass extends Component {
@ -11,6 +12,12 @@ class Jointheclass extends Component {
componentDidMount() {
// console.log("加入精品课堂");
// console.log(this.props);
let type=this.props.yslJointhe===undefined?false:this.props.yslJointhe;
if(type===true){
this.setState({
Modalstype:true
})
}
}
@ -48,35 +55,15 @@ class Jointheclass extends Component {
// console.log("加入精品课堂2");
//console.log(this.props.Pathcourseid);
return(
<Modal
keyboard={false}
closable={false}
footer={null}
destroyOnClose={true}
title="提示"
centered={true}
visible={this.props.yslJointhe===undefined?false:this.props.yslJointhe}
width="600px"
>
<div className="educouddiv">
<div className={"tabeltext-alignleft"}><p className={"mt70 mb70 font-16"}>是否确认加入该课堂?</p></div>
<div className="clearfix edu-txt-center mt20">
<style>
{
`
a:hover {
color: #fff !important;
}
`
}
</style>
<a className="task-btn mr30" onClick={()=>this.modalCancel()}>取消</a>
<a className="task-btn task-btn-orange" onClick={()=>this.setDownload()}>确认</a>
</div>
</div>
</Modal>
<Modals
modalsType={this.props.yslJointhe===undefined?false:this.props.yslJointhe}
modalsTopval={"是否确定加入该课堂?"}
modalCancel={()=>this.modalCancel()}
modalSave={()=>this.setDownload()}
></Modals>
)
}
}
export default Jointheclass;
export default Jointheclass;

@ -527,9 +527,7 @@ class DetailTop extends Component{
<div key={key}>
{item.course_status.status===0?<div className="mr51 shixun_detail pointer fl user-colorgrey-green pathdefault">即将开课</div>:""}
{item.course_status.status===1?<div className="mr51 shixun_detail pointer fl color-orange pathdefault">{item.course_status.time}</div>:""}
{item.course_status.status===2?
detailInfoList.is_creator===true||detailInfoList.allow_add_member===true?<div className="mr51 shixun_detail pointer fl user-colorgrey-9b pathdefault">已结束</div>:item.course_identity<6?
<div className="mr51 shixun_detail pointer fl user-colorgrey-9b pathdefault">已结束</div>:"":""}
{item.course_status.status===2&&item.course_identity<6?<div className="mr51 shixun_detail pointer fl user-colorgrey-9b pathdefault">已结束</div>:""}
{item.course_status.status===0?
item.course_identity<5?<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" href={item.first_category_url} target="_blank">

Loading…
Cancel
Save