Merge branch 'dev_aliyun' into develop

chromesetting
daiao 5 years ago
commit 4e0a46be8d

@ -67,15 +67,11 @@ class ShixunsController < ApplicationController
## 排序参数
bsort = params[:sort] || 'desc'
case params[:order_by] || 'publish_time'
when 'new'
@shixuns = @shixuns.order("shixuns.status = 2 desc, shixuns.created_at #{bsort}")
case params[:order_by] || 'new'
when 'hot'
@shixuns = @shixuns.order("shixuns.status = 2 desc, shixuns.myshixuns_count #{bsort}")
when 'mine'
@shixuns = @shixuns.order("shixuns.created_at #{bsort}")
@shixuns = @shixuns.order("shixuns.public = 2 desc, shixuns.myshixuns_count #{bsort}")
else
@shixuns = @shixuns.order("shixuns.status = 2 desc, shixuns.publish_time #{bsort}")
@shixuns = @shixuns.order("shixuns.public = 2 desc, shixuns.publish_time #{bsort}")
end
# 用id计数会快10+MS左右,对于搜索的内容随着数据的增加,性能会提升一些。
@ -265,7 +261,12 @@ class ShixunsController < ApplicationController
project_fork(@new_shixun, @repo_path, current_user.login)
ShixunMember.create!(:user_id => User.current.id, :shixun_id => @new_shixun.try(:id), :role => 1)
# 如果是jupyter先创建一个目录,为了挂载(因为后续数据集开启Pod后环境在没销毁前你上传数据集是挂载不上目录的因此要先创建目录方便中间层挂载)
if @new_shixun.is_jupyter?
folder = EduSetting.get('shixun_folder')
path = "#{folder}/#{@new_shixun.identifier}"
FileUtils.mkdir_p(path, :mode => 0777) unless File.directory?(path)
end
# 同步复制关卡
if @shixun.challenges.present?
@shixun.challenges.each do |challenge|

@ -20,15 +20,8 @@ module JupyterService
logger.info "test_juypter: #{res}"
@shixun_jupyter_port = res['port']
jupyter_service = edu_setting('jupyter_service')
url =
if false
"https://#{jupyter_service}:#{res['port']}/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
else
"https://#{res['port']}.#{jupyter_service}/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
end
return url
"#{jupyter_service(res['port'])}/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
end
end
@ -55,7 +48,7 @@ module JupyterService
tpiID = myshixun.id
mount = myshixun.shixun.data_sets.present?
params = {tpiID: tpiID, identifier: shixun.identifier, needMount: mount,
params = {tpiID: tpiID, identifier: shixun.identifier, myshixunIdentifier: myshixun.identifier, needMount: mount,
:containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
res = uri_post uri, params
@ -69,14 +62,7 @@ module JupyterService
repo_save_path = myshixun.repo_save_path
jupyter_service = edu_setting('jupyter_service')
if false
"https://#{jupyter_service}:#{res['port']}/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
else
"https://#{res['port']}.#{jupyter_service}/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
end
"#{jupyter_service(res['port'])}/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
end
end
@ -99,14 +85,8 @@ module JupyterService
tpiID = "tpm#{shixun.id}"
jupyter_service = edu_setting('jupyter_service')
src_url =
if false
"https://#{jupyter_service}:#{jupyter_port}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true"
else
"https://#{jupyter_port}.#{jupyter_service}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true"
end
#https://47526.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_570461/f2ef5p798r20191210163135/01.ipynb?download=true
src_url = "#{jupyter_service(jupyter_port)}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true"
response = Faraday.get(src_url)
if response.status.to_i != 200
@ -133,15 +113,7 @@ module JupyterService
tpiID = myshixun.id
repo_save_path = myshixun.repo_save_path
jupyter_service = edu_setting('jupyter_service')
src_url =
if false
"https://#{jupyter_service}:#{jupyter_port}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true"
else
"https://#{jupyter_port}.#{jupyter_service}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true"
end
src_url = "#{jupyter_service(jupyter_port)}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true"
response = Faraday.get(src_url)
if response.status.to_i != 200
@ -215,5 +187,9 @@ module JupyterService
end
end
def jupyter_service jupyter_port
edu_setting('jupyter_service').gsub("PORT", jupyter_port)
end
end

@ -42,6 +42,12 @@ class CreateShixunService < ApplicationService
if !Laboratory.current.main_site?
Laboratory.current.laboratory_shixuns.create!(shixun: shixun, ownership: true)
end
# 如果是jupyter先创建一个目录,为了挂载(因为后续数据集开启Pod后环境在没销毁前你上传数据集是挂载不上目录的因此要先创建目录方便中间层挂载)
if shixun.is_jupyter?
folder = EduSetting.get('shixun_folder')
path = "#{folder}/#{identifier}"
FileUtils.mkdir_p(path, :mode => 0777) unless File.directory?(path)
end
return shixun
end
rescue => e

@ -326,8 +326,8 @@ module.exports = {
comments: false
},
compress: {
drop_debugger: true,
drop_console: true
drop_debugger: false,
drop_console: false
}
}
}),

@ -893,6 +893,7 @@ class PollNew extends Component {
//保存并继续
//保存并继续,即提交本题的新建并继续创建一个相同的题(该新题处于编辑模式,题目和选项不要清空)
Deleteadddomtwo = (indexo, object,bool) => {
debugger
var thiss = this;
@ -1449,7 +1450,6 @@ class PollNew extends Component {
//object 单个数组数据
Deleteadddomthree = (indexo, object,bool) => {
this.setState({
Newdisplay:false,
newoption: false,
})
// console.log("deleteadddom 349")
@ -1477,6 +1477,7 @@ class PollNew extends Component {
}
if (newarr[indexo].question.question_title === "") {
this.props.showNotification('题目不能为空!');
return
}
if (max > 0) {
@ -1866,6 +1867,7 @@ class PollNew extends Component {
};
question = {"question": questiontwo};
//插入多选题
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
@ -2014,7 +2016,11 @@ class PollNew extends Component {
if (result !== undefined) {
if (result.data.status === 0) {
this.props.showNotification(`已完成`);
thiss.thisinitializationdatanew();
this.setState({
Newdisplay:false,
})
// console.log("确认创建问题")
// console.log(result)
// try {

@ -99,7 +99,6 @@ class Statistics extends Component{
}
getwork_scoredata=(page,group_ids,sort,key)=>{
this.setState({
page:page,
sort:sort,
@ -189,8 +188,45 @@ class Statistics extends Component{
}
//计算成绩
setComputeTimet = (homeworkid) => {
let url = `/courses/${homeworkid}/calculate_all_shixun_scores.json`;
try {
this.props.yslslowCheckresults();
} catch (e) {
}
axios.get(url).then((response) => {
if (response) {
if (response.data.status === 0) {
let{page,group_ids,sort}=this.state;
setTimeout(() => {
try {
this.props.showNotification(`${response.data.message}`);
} catch (e) {
}
try {
this.props.yslslowCheckresultsNo();
} catch (e) {
}
this.getwork_scoredata(page,group_ids,sort);
}, 2500);
}
}
}).catch((error) => {
try {
this.props.yslslowCheckresultsNo();
} catch (e) {
}
console.log(error)
});
};
render(){
let {nd1,nd2,nd3,data,bomdata,course_members}=this.state;
let {nd1,nd2,nd3,data,bomdata,course_members,activeKey}=this.state;
const columns = [
{
@ -360,12 +396,26 @@ class Statistics extends Component{
const operations = <React.Fragment>
{course_grouptype===false||this.state.course_groups.length===0?"":<Dropdownbox
{...this.props}
{...this.state}
postwork_scoredata={(group_idss)=>this.getwork_scoredata(1,group_idss,'desc')}
/>}
{course_grouptype===false||this.state.course_groups.length===0?"":
this.state.activeKey==="1"?
<Dropdownbox
{...this.props}
{...this.state}
postwork_scoredata={(group_idss)=>this.getwork_scoredata(1,group_idss,'desc')
}
/>
:""
}
{
this.state.activeKey==="1"?
<a className={"ml20 ant-btn-link"} onClick={()=>this.setComputeTimet(this.props.match.params.coursesId)}>获取最新成绩</a>
:""
}
{
this.state.activeKey==="1"?
<a className={"ml20 ant-btn-link"} onClick={()=>this.derivefun(this.state.activeKey==="1"?`/courses/${this.props.match.params.coursesId}/export_member_scores_excel.xlsx`:`/courses/${this.props.match.params.coursesId}/export_member_act_score.xlsx`)}>导出</a>
:""
}
</React.Fragment>;
return(
<React.Fragment>

@ -843,7 +843,7 @@ class TPMBanner extends Component {
<ul className="fl color-grey-c pathInfo">
<li>
<span>学习人数</span>
<span className="mt10">{shixunsDetails.stu_num}</span>
<span className="mt3">{shixunsDetails.stu_num}</span>
</li>
{/*<li>*/}
{/*<span>经验值</span>*/}
@ -851,7 +851,7 @@ class TPMBanner extends Component {
{/*</li>*/}
<li>
<span>难度级别</span>
<span className="shixunsdiffcult mt10">{shixunsDetails.diffcult}</span>
<span className="shixunsdiffcult mt3">{shixunsDetails.diffcult}</span>
</li>
</ul>

Loading…
Cancel
Save