Merge branch 'dev_aliyun' into dev_jupyter

ecloud_sso
daiao 5 years ago
commit a28e0a70b8

@ -395,9 +395,7 @@ class CoursesController < ApplicationController
def destroy
if @course.is_delete == 0
@course.delete!
Tiding.where(belong_container: @course).update_all(is_delete: 1)
Tiding.create!(user_id: current_user.id, trigger_user_id: current_user.id, container_id: @course.id,
container_type: 'DeleteCourse', tiding_type: 'System', belong_container: @course, extra: @course.name)
DeleteCourseNotifyJob.perform_later(@course.id, current_user.id)
normal_status(0, "成功")
else
normal_status(-1, "课堂已删除,无需重复操作")

@ -984,7 +984,7 @@ class HomeworkCommonsController < ApplicationController
homework.homework_detail_manual.update_attributes!(comment_status: 1)
if homework.course_act.blank?
homework.course_act << CourseActivity.new(user_id: homework.user_id, course_id: homework.course_id)
CourseActivity.create!(user_id: homework.user_id, course_id: homework.course_id, course_act: homework)
end
# 发消息
HomeworkCommonPushNotifyJob.perform_later(homework.id, tiding_group_ids)
@ -1117,7 +1117,7 @@ class HomeworkCommonsController < ApplicationController
def choose_category
@main_catrgory = @course.course_modules.where(module_type: "shixun_homework")
@homework_category = @main_catrgory.take.course_second_categories
@homework_category = @main_catrgory.take.course_second_categories.includes(:homework_commons)
end
# 实训作业移动到目录

@ -20,6 +20,7 @@ class Weapps::CoursesController < Weapps::BaseController
activities = @course.course_activities.where("course_act_type in ('Course', 'CourseMessage') or
(course_act_type = 'HomeworkCommon' and course_act_id in #{homework_ids})").order("id desc")
@activities_count = activities.size
@activities = paginate activities.includes(:course_act, user: :user_extension)
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?

@ -0,0 +1,13 @@
# 删除课堂时将相应的课堂消息置为删除状态,并给老师发送删除消息
class DeleteCourseNotifyJob < ApplicationJob
queue_as :default
def perform(course_id, user_id)
course = Course.find_by(id: course_id)
return if course.blank?
Tiding.where(belong_container: course).update_all(is_delete: 1)
Tiding.create!(user_id: user_id, trigger_user_id: user_id, container_id: course.id,
container_type: 'DeleteCourse', tiding_type: 'System', belong_container: course, extra: course.name)
end
end

@ -302,7 +302,7 @@ class Course < ApplicationRecord
#课程动态公共表记录
def act_as_course_activity
self.course_act << CourseActivity.new(user_id: tea_id, course_id: id)
CourseActivity.create(user_id: tea_id, course_id: id, course_act: self)
end
# 当前老师分班下的所有学生

@ -30,7 +30,7 @@ class CourseMessage < ApplicationRecord
#课程动态公共表记录
def act_as_course_activity
self.course_act << CourseActivity.new(user_id: course_message_id, course_id: course_id)
CourseActivity.create(user_id: course_message_id, course_id: course_id, course_act: self)
end
def send_deal_tiding deal_status

@ -12,4 +12,13 @@ class CourseSecondCategory < ApplicationRecord
category_type == "graduation" && name == "毕设任务" ? "graduation_tasks" : category_type
)
end
def homework_publish_count
homework_commons.select{|homework| homework.publish_time.present? && homework.publish_time <= Time.now}.size
end
def homework_unpublish_count
homework_commons.select{|homework| homework.publish_time.nil? || homework.publish_time > Time.now}.size
end
end

@ -14,7 +14,7 @@ class Oauth::CreateORFindCasUserService < ApplicationService
return [open_user.user, false] if open_user.persisted?
@user = User.new(login: User.generate_login('C'), type: 'User', status: User::STATUS_ACTIVE, nickname: @params['comsys_name'], lastname: @params['comsys_name'])
@user = User.new(login: User.generate_login('C'), type: 'User', status: User::STATUS_ACTIVE, lastname: @params['comsys_name'])
ActiveRecord::Base.transaction do
@user.save!

@ -1,8 +1,15 @@
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
json.category_name category.name
json.publish_count category.homework_publish_count
json.unpublish_count category.homework_unpublish_count
json.all_count category.homework_commons.size
end

@ -6,7 +6,8 @@ json.activities @activities do |activity|
json.login user.login
json.img url_to_avatar(user)
end
json.created_at activity.created_at.strftime('%m-%d %H:%M:')
json.created_at activity.created_at.strftime('%m-%d %H:%M')
json.container_name activity.container_name
json.container_type activity.course_act_type == "HomeworkCommon" ? activity.course_act&.homework_type : ""
end
json.activities_count @activities_count

@ -45,7 +45,7 @@ namespace :homework_publishtime do
end
end
homework.course_act << CourseActivity.new(user_id: homework.user_id, course_id: homework.course_id) if !homework.course_act.present?
CourseActivity.create(user_id: homework.user_id, course_id: homework.course_id, course_act: homework) if !homework.course_act.present?
end
# 分组设置发布时间的作业

@ -60,7 +60,7 @@ function requestForSignatrue (callback) {
/**
实践课程 平台提供涵盖基础入门案例实践和创新应用的完整实训项目体系通过由浅入深的实训路径帮助学生快速提升实战能力
实训项目 覆盖不同专业的IT实验和实训每周更新无需配置本机实验环境随时随地开启企业级真实实训
翻转课堂 自动评测实训任务支持技能统计提供教学活动分析报告减轻教师和助教的辅导压力免去作业发布和批改的困扰实时了解学生学习情况全面提升教师施教效率和水平
教学课堂 自动评测实训任务支持技能统计提供教学活动分析报告减轻教师和助教的辅导压力免去作业发布和批改的困扰实时了解学生学习情况全面提升教师施教效率和水平
单个课程和实训 获取课程/实训的简介 该课程或者实训展示的缩略图
*/
@ -108,7 +108,7 @@ export function configShareForCourses () {
console.log('configShareForCourses', host)
var shareData = {
title: 'EduCoder - 翻转课堂',
title: 'EduCoder - 教学课堂',
desc: '自动评测实训任务,支持技能统计,提供教学活动分析报告,减轻教师和助教的辅导压力,免去作业发布和批改的困扰,实时了解学生学习情况,全面提升教师施教效率和水平。',
link: `${host}/courses`,
imgUrl: window.__testImageUrl

@ -250,7 +250,7 @@ class Competitionteams extends Component{
<Content className={"teamsLayoutContent"}>
<Table className="teamsLayoutTable" columns={shixuncolumns} dataSource={this.state.shixundata} bordered pagination={false}/>
</Content>
<Content className={"teamsLayoutitle mt40"}>翻转课堂</Content>
<Content className={"teamsLayoutitle mt40"}>教学课堂</Content>
<Content className={"teamsLayoutContents"}>
<Table className="teamsLayoutTable" columns={coursecolumns} dataSource={this.state.coursedata} bordered pagination={false}/>
</Content>

@ -250,7 +250,7 @@ class Competitionteams extends Component{
<Content className={"teamsLayoutContent"}>
<Table className="teamsLayoutTable" columns={shixuncolumns} dataSource={this.state.shixundata} bordered pagination={false}/>
</Content>
<Content className={"teamsLayoutitle mt40"}>翻转课堂</Content>
<Content className={"teamsLayoutitle mt40"}>教学课堂</Content>
<Content className={"teamsLayoutContents"}>
<Table className="teamsLayoutTable" columns={coursecolumns} dataSource={this.state.coursedata} bordered pagination={false}/>
</Content>

@ -55,7 +55,7 @@ class CoursesHome extends Component{
}
componentDidMount(){
document.title="翻转课堂";
document.title="教学课堂";
const upsystem=`/users/system_update.json`;
axios.get(upsystem).then((response)=>{
let updata=response.data;
@ -159,7 +159,7 @@ class CoursesHome extends Component{
onClick={ () => this.changeStatus("created_at")}>最新</a>
<a className={ order == "visits" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"}
onClick={ () => this.changeStatus("visits")}>最热</a>
{this.props.user&&this.props.user.user_identity==="学生"?"":<span className={ "fr font-16 bestChoose color-blue" } onClick={(url)=>this.getUser("/courses/new")}>+新建翻转课堂</span>}
{this.props.user&&this.props.user.user_identity==="学生"?"":<span className={ "fr font-16 bestChoose color-blue" } onClick={(url)=>this.getUser("/courses/new")}>+新建教学课堂</span>}
{/*<div className="fr mr5 search-new">*/}
{/*/!* <Search*/}

@ -690,7 +690,7 @@ class CoursesNew extends Component {
<a className="btn colorgrey fl hovercolorblue "
href={this.props.match.params.coursesId === undefined ?"/courses":this.props.current_user&&this.props.current_user.first_category_url}
>
{this.props.match.params.coursesId === undefined ?"翻转课堂":dataname}
{this.props.match.params.coursesId === undefined ?"教学课堂":dataname}
</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<span className="fl cdefault">{this.props.match.params.coursesId === undefined ?"新建课堂":"编辑课堂"}</span>

@ -721,7 +721,7 @@ class Goldsubject extends Component {
{/*</Breadcrumb>*/}
<p className="clearfix mb20 mt10">
<a className="btn colorgrey fl hovercolorblue " href={Whethertocreateanewclassroom===true?"/courses":this.props.current_user&&this.props.current_user.first_category_url}
>{Whethertocreateanewclassroom===true?"翻转课堂":name}</a>
>{Whethertocreateanewclassroom===true?"教学课堂":name}</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<span className="fl cdefault">{Whethertocreateanewclassroom===true?"新建课堂":"编辑课堂"}</span>
</p>

@ -1129,7 +1129,7 @@ submittojoinclass=(value)=>{
{/*<li><a href={this.props.Headertop===undefined?"":'/courses'}>课堂</a></li>*/}
<li className={`${coursestype === true ? 'pr active' : 'pr'}`}>
{/*<a href={this.props.Headertop===undefined?"":this.props.Headertop.course_url}>课堂</a>*/}
<Link to={this.props.Headertop===undefined?"":'/courses'}>翻转课堂</Link>
<Link to={this.props.Headertop===undefined?"":'/courses'}>教学课堂</Link>
</li>
<li className={`${activeShixuns === true ? 'pr active' : 'pr'}`}>
<Link to="/shixuns">实训项目</Link>
@ -1215,7 +1215,7 @@ submittojoinclass=(value)=>{
onBlur={(e)=>this.hideshowSearchOpen(e)} onMouseLeave={()=>this.setevaluatinghides()}>
<Search
id={"HeaderSearchs"}
placeholder="实践课程/翻转课堂/实训项目/交流问答"
placeholder="实践课程/教学课堂/实训项目/交流问答"
onInput={()=>this.onKeywordSearchKeyDowns()}
onSearch={(value) => this.onKeywordSearchKeyDown(value)}
// onPressEnter={this.onKeywordSearchKeyDown}
@ -1262,7 +1262,7 @@ submittojoinclass=(value)=>{
<ul className="edu-menu-list" style={{top:'60px'}}>
{/*<span className="bor-bottom-greyE currentName task-hide">{user.username}</span>*/}
<li><Link to={`/users/${this.props.current_user.login}/courses`}>我的个人主页</Link></li>
{coursestypes===true?"":<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/courses`}>{this.props.user&&this.props.user.main_site===false?"我的课堂":"我的翻转课堂"}</Link></li>}
{coursestypes===true?"":<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/courses`}>{this.props.user&&this.props.user.main_site===false?"我的课堂":"我的教学课堂"}</Link></li>}
{/* p 老师 l 学生 */}
{shixuntype===true?"":<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/shixuns`}>我的实训项目</Link></li>}
{pathstype===true?"":<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/paths`}>{this.props.user&&this.props.user.main_site===false?"我的课程":"我的实践课程"}</Link></li>}
@ -1314,7 +1314,7 @@ submittojoinclass=(value)=>{
<div className="overPart"></div>
<ul className={coursestypes===true&&this.props.user&&this.props.user.main_site===false?"fl headwith100b edu-txt-center pr ul-leftline":"fl with50 edu-txt-center pr ul-leftline"}>
{this.props.current_user&&this.props.current_user.user_identity==="学生"?"":coursestypes===false?
<li><a onClick={(url)=>this.getUser("/courses/new")}>{this.props.user&&this.props.user.main_site===false?"新建课堂":"新建翻转课堂"}</a></li>:""
<li><a onClick={(url)=>this.getUser("/courses/new")}>{this.props.user&&this.props.user.main_site===false?"新建课堂":"新建教学课堂"}</a></li>:""
}
{shixuntype===true?"":
<li><a onClick={(url)=>this.getUser("/shixuns/new","newshixuns")}>新建实训项目</a></li>
@ -1328,7 +1328,7 @@ submittojoinclass=(value)=>{
{coursestypes===true&&this.props.user&&this.props.user.main_site===false?"":<ul className="fl with50 edu-txt-center">
{coursestypes===true?"":<li>
<a onClick={this.tojoinclass}>{this.props.user&&this.props.user.main_site===false?"加入课堂":"加入翻转课堂"}</a>
<a onClick={this.tojoinclass}>{this.props.user&&this.props.user.main_site===false?"加入课堂":"加入教学课堂"}</a>
</li>}
{Addcoursestypes===true?<Addcourses

@ -163,7 +163,7 @@ export function TPMIndexHOC(WrappedComponent) {
}else if(this.props.match.path==="/paths"){
document.title="实践课程";
}else if(this.props.match.path==="/courses"){
document.title="翻转课堂";
document.title="教学课堂";
}
// if(this.props.match.path==="/"){

@ -953,9 +953,9 @@ class Shixuninformation extends Component {
<div>
{this.state.mainvalues === undefined && this.state.subvalues === undefined || this.state.mainvalues === "" && this.state.subvalues === "" ? "" :
<div className={"font-12"} style={{'max-width': '600px'}}>
{`${this.state.mainvalues === undefined || this.state.mainvalues === "" ? "" : this.state.mainvalues}`}
{`${this.state.subvalues === undefined || this.state.subvalues === "" ? "" : this.state.mainvalues === undefined || this.state.mainvalues === "" ? this.state.subvalues : this.state.subvalues}`}
{`${this.state.mainvalues === undefined || this.state.mainvalues === "" ? "" : this.state.mainvalues}${this.state.subvalues === undefined || this.state.subvalues === "" ? "" :
{`${this.state.mainvalues === undefined || this.state.mainvalues === "" ? "" : this.state.mainvalues}`}
{`${this.state.subvalues === undefined || this.state.subvalues === "" ? "" : this.state.mainvalues === undefined || this.state.mainvalues === "" ? this.state.subvalues : this.state.subvalues}`}
{`${this.state.mainvalues === undefined || this.state.mainvalues === "" ? "" : ""}${this.state.subvalues === undefined || this.state.subvalues === "" ? "" :
this.state.mainvalues === undefined || this.state.mainvalues === "" ? this.state.subvalues : this.state.subvalues}`}
</div>}
</div>

@ -620,9 +620,9 @@ class Newshixuns extends Component {
<div>
{this.state.mainvalues === undefined && this.state.subvalues === undefined || this.state.mainvalues === "" && this.state.subvalues === "" ? "" :
<div className={"font-12"} style={{'max-width': '600px'}}>
{`${this.state.mainvalues === undefined || this.state.mainvalues === "" ? "" : this.state.mainvalues}`}
{`${this.state.mainvalues === undefined || this.state.mainvalues === "" ? "" : this.state.mainvalues}`}
{`${this.state.subvalues === undefined || this.state.subvalues === "" ? "" : this.state.mainvalues === undefined || this.state.mainvalues === "" ? this.state.subvalues : this.state.subvalues}`}
{`${this.state.mainvalues === undefined || this.state.mainvalues === "" ? "" : this.state.mainvalues}${this.state.subvalues === undefined || this.state.subvalues === "" ? "" :
{`${this.state.mainvalues === undefined || this.state.mainvalues === "" ? "" : ""}${this.state.subvalues === undefined || this.state.subvalues === "" ? "" :
this.state.mainvalues === undefined || this.state.mainvalues === "" ? this.state.subvalues : this.state.subvalues}`}
</div>}

@ -120,7 +120,7 @@ class InfosBanner extends Component{
{coursestypes===true?"":<li className={`${moduleName == 'courses' ||moduleName == undefined ? 'active' : '' }`}>
<Link
onClick={() => this.setState({moduleName: 'courses'})}
to={`/users/${username}/courses`}>翻转课堂</Link>
to={`/users/${username}/courses`}>教学课堂</Link>
</li>}
{shixuntype===true?"":<li className={`${moduleName == 'shixuns' ? 'active' : '' }`}>
<Link

@ -158,7 +158,7 @@ class SearchPage extends Component{
<div className="tabtitles2">
<Menu mode="horizontal" className="tabtitless" selectedKeys={tab} onClick={this.changeTab}>
<Menu.Item className={"tabtitle1"} key="1">实践课程</Menu.Item>
<Menu.Item className={"tabtitle2"} key="2">翻转课堂</Menu.Item>
<Menu.Item className={"tabtitle2"} key="2">教学课堂</Menu.Item>
<Menu.Item className={"tabtitle2"} key="0">实训项目</Menu.Item>
<Menu.Item className={"tabtitle2"} key="3">交流问答</Menu.Item>
</Menu>

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe DeleteCourseNotifyJob, type: :job do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save