diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index cf7ac6d2e..5eca6ccf9 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -319,6 +319,8 @@ class ApplicationController < ActionController::Base
# 通关后,把最后一次成功的代码存到数据库
# type 0 创始内容, 1 最新内容
def game_passed_code(path, myshixun, game_id)
+ # 如果代码窗口是隐藏的,则不用保存代码
+ return if myshixun.shixun.hide_code
file_content = git_fle_content myshixun.repo_path, path
unless file_content.present?
raise("获取文件代码异常")
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 973e73dac..bb0737128 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -169,7 +169,7 @@ class CoursesController < ApplicationController
extra_params[:school_id] = @school.id
extra_params[:is_public] = params[:is_public].present? ? params[:is_public] : 0
- if @course.is_end && (course_params[:end_date].nil? || course_params[:end_date].to_date > Date.today)
+ if @course.is_end && (course_params[:end_date].blank? || course_params[:end_date].to_date > Date.today)
extra_params[:is_end] = 0
elsif !@course.is_end && !course_params[:end_date].blank? && course_params[:end_date].to_date < Date.today
extra_params[:is_end] = 1
diff --git a/app/controllers/departments_controller.rb b/app/controllers/departments_controller.rb
index f0fa8fe2c..b6ebcb2ef 100644
--- a/app/controllers/departments_controller.rb
+++ b/app/controllers/departments_controller.rb
@@ -1,6 +1,6 @@
class DepartmentsController < ApplicationController
def for_option
- render_ok(departments: Department.cached_names_data(current_school))
+ render_ok(departments: current_school.departments.select(:id, :name).as_json)
end
private
diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb
index 0a19f1c08..169f689f6 100644
--- a/app/controllers/myshixuns_controller.rb
+++ b/app/controllers/myshixuns_controller.rb
@@ -90,9 +90,11 @@ class MyshixunsController < ApplicationController
# params[:pics] = "a.png,b.png,c.png"
def training_task_status
+ logger.info("##################training_task_status_start#{params[:jsonTestDetails][:buildID]}")
ActiveRecord::Base.transaction do
begin
t1 = Time.now
+ Rails.logger.info("@@@222222#{params[:jsonTestDetails]}")
jsonTestDetails = JSON.parse(params[:jsonTestDetails])
timeCost = JSON.parse(params[:timeCost])
brige_end_time = Time.parse(timeCost['evaluateEnd']) if timeCost['evaluateEnd'].present?
@@ -129,8 +131,8 @@ class MyshixunsController < ApplicationController
# is_public = test_sets.where(:position => j_test_set['caseId']).first.try(:is_public)
logger.info "actual_output:################################################# #{actual_output}"
- ts_time = format("%.2f", j_test_set['testSetTime'].to_f/1000000000).to_f
- ts_mem = format("%.2f", j_test_set['testSetMem'].to_f/1024/1024).to_f
+ ts_time = format("%.2f", j_test_set['testSetTime'].to_f/1000000000).to_f if j_test_set['testSetTime']
+ ts_mem = format("%.2f", j_test_set['testSetMem'].to_f/1024/1024).to_f if j_test_set['testSetMem']
Output.create!(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'],
:actual_output => actual_output, :result => j_test_set['passed'].to_i, :query_index => max_query_index,
@@ -209,10 +211,10 @@ class MyshixunsController < ApplicationController
end
uid_logger("training_task_status start#4**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
sucess_status
- rescue Exception => e
- tip_exception(e.message)
- uid_logger_error("training_task_status error: #{e}")
- raise ActiveRecord::Rollback
+ # rescue Exception => e
+ # tip_exception(e.message)
+ # uid_logger_error("training_task_status error: #{e}")
+ # raise ActiveRecord::Rollback
end
end
end
diff --git a/app/controllers/repertoires_controller.rb b/app/controllers/repertoires_controller.rb
index 0ac78a15b..b62c94403 100644
--- a/app/controllers/repertoires_controller.rb
+++ b/app/controllers/repertoires_controller.rb
@@ -1,5 +1,5 @@
class RepertoiresController < ApplicationController
def index
- render_ok(repertoires: Repertoire.cache_data)
+ render_ok(repertoires: Repertoire.select(:id, :name).order(:created_at).as_json)
end
end
\ No newline at end of file
diff --git a/app/controllers/schools_controller.rb b/app/controllers/schools_controller.rb
index ea94f4c69..f0dd6dd75 100644
--- a/app/controllers/schools_controller.rb
+++ b/app/controllers/schools_controller.rb
@@ -11,6 +11,6 @@ class SchoolsController < ApplicationController
end
def for_option
- render_ok(schools: School.cached_names_data)
+ render_ok(schools: School.select(:id, :name).as_json)
end
end
diff --git a/app/models/department.rb b/app/models/department.rb
index bf5c3a90e..15a8a7c1b 100644
--- a/app/models/department.rb
+++ b/app/models/department.rb
@@ -2,26 +2,4 @@ class Department < ApplicationRecord
belongs_to :school
has_many :department_members, dependent: :destroy
-
- after_create_commit :reset_data_cache
- after_update_commit :reset_data_cache
-
- def self.cached_names_data(school)
- Rails.cache.fetch(names_data_cache_key(school.id), expires_in: 7.days) do
- school.departments.select(:id, :name).as_json
- end
- end
-
- private
-
- def reset_data_cache
- # 清除部门名称缓存
- if new_record? || name_previously_changed?
- Rails.cache.delete(self.class.names_data_cache_key(school_id))
- end
- end
-
- def self.names_data_cache_key(school_id)
- "schools/#{school_id}/department_names_data"
- end
end
diff --git a/app/models/repertoire.rb b/app/models/repertoire.rb
index 140416658..72e1ebfff 100644
--- a/app/models/repertoire.rb
+++ b/app/models/repertoire.rb
@@ -3,23 +3,4 @@ class Repertoire < ApplicationRecord
has_many :tag_repertoires, through: :sub_repertoires
has_many :user_interests, dependent: :delete_all
-
- after_create_commit :reset_cache_data
- after_update_commit :reset_cache_data
-
- def self.cache_data
- Rails.cache.fetch(data_cache_key, expires_in: 1.days) do
- Repertoire.select(:id, :name).order(:created_at).as_json
- end
- end
-
- def self.data_cache_key
- 'repertoire/cache_data'
- end
-
- private
-
- def reset_cache_data
- Rails.cache.delete(self.class.data_cache_key)
- end
end
diff --git a/app/models/school.rb b/app/models/school.rb
index 983a93735..a0c829160 100644
--- a/app/models/school.rb
+++ b/app/models/school.rb
@@ -10,9 +10,6 @@ class School < ApplicationRecord
has_many :ec_major_schools, :dependent => :destroy
has_many :ec_majors, :through => :ec_major_schools
- after_create_commit :reset_data_cache
- after_update_commit :reset_data_cache
-
# 学校管理员
def manager?(user)
ec_school_users.exists?(user_id: user.id)
@@ -33,23 +30,4 @@ class School < ApplicationRecord
def manage_permission?(user)
manager?(user) || major_manager?(user) || course_manager?(user)
end
-
- def self.cached_names_data
- Rails.cache.fetch(names_data_cache_key, expires_in: 7.days) do
- School.select(:id, :name).as_json
- end
- end
-
- private
-
- def reset_data_cache
- # 清除学校名称缓存
- if new_record? || name_previously_changed?
- Rails.cache.delete(self.class.names_data_cache_key)
- end
- end
-
- def self.names_data_cache_key
- 'schools/names_data'
- end
end
diff --git a/public/react/config/webpack.config.prod.js b/public/react/config/webpack.config.prod.js
index 7b9795e80..0abd707af 100644
--- a/public/react/config/webpack.config.prod.js
+++ b/public/react/config/webpack.config.prod.js
@@ -301,8 +301,8 @@ module.exports = {
},
warnings: false,
compress: {
- drop_debugger: true,
- drop_console: true
+ drop_debugger: false,
+ drop_console: false
}
}
}),
diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js
index 003ef5a9b..02d8c2be5 100644
--- a/public/react/src/AppConfig.js
+++ b/public/react/src/AppConfig.js
@@ -2,7 +2,7 @@ import React from "react";
import axios from 'axios';
import { requestProxy } from "./indexEduplus2RequestProxy";
-import { broadcastChannelOnmessage ,SetAppModel, isDev, queryString} from 'educoder';
+import { broadcastChannelOnmessage ,SetAppModel} from 'educoder';
import { notification } from 'antd';
import './index.css'
broadcastChannelOnmessage('refreshPage', () => {
@@ -18,19 +18,10 @@ function locationurl(list){
}
// TODO 开发期多个身份切换
-let debugType = ""
-if (isDev) {
- const _search = window.location.search;
- let parsed = {};
- if (_search) {
- parsed = queryString.parse(_search);
- }
- debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
- window.location.search.indexOf('debug=s') != -1 ? 'student' :
- window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || ''
-}
-
-window._debugType = debugType;
+const debugType =""
+// window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
+// window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin'
+// window._debugType = debugType;
export function initAxiosInterceptors(props) {
// TODO 避免重复的请求 https://github.com/axios/axios#cancellation
@@ -121,7 +112,7 @@ export function initAxiosInterceptors(props) {
// https://github.com/axios/axios/issues/583
// message.info(response.data.message || '服务端返回status -1,请联系管理员。');
// props.showSnackbar( response.data.message || '服务器异常,请联系管理员。' )
- if (window.location.pathname.startsWith('/tasks/')) {
+ if (window.location.pathname.startsWith('/tasks/')) {
props.showSnackbar( response.data.message || '服务器异常,请联系管理员。' )
} else {
notification.open({
@@ -136,7 +127,7 @@ export function initAxiosInterceptors(props) {
// description: response.data.message || '服务器异常,请联系管理员。',
// });
}
-
+
throw new axios.Cancel('Operation canceled by the user.');
}
// if(response.data.status === 401){
diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js
index e8bd8b9cf..922c68650 100644
--- a/public/react/src/modules/courses/coursesPublic/Addcourses.js
+++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js
@@ -147,6 +147,8 @@ class Addcourses extends Component{
if(Addcoursestype===true){
this.props.hideAddcoursestype();
+ }else{
+ window.location.href = "/";
}
}
diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js
index c5d0009c1..1183b59e9 100644
--- a/public/react/src/modules/courses/new/CoursesNew.js
+++ b/public/react/src/modules/courses/new/CoursesNew.js
@@ -88,11 +88,11 @@ class CoursesNew extends Component {
}
componentDidUpdate(prevProps){
- if(prevProps.current_user!=this.props.current_user){
- if(this.props.current_user.user_identity==="学生"){
- window.location.href ="/403"
- }
- }
+ // if(prevProps.current_user!=this.props.current_user){
+ // if(this.props.current_user.user_identity==="学生"){
+ // window.location.href ="/403"
+ // }
+ // }
}
onChangeTimepublishs = (date, dateString) => {
if(dateString===""){
@@ -132,7 +132,7 @@ class CoursesNew extends Component {
e.preventDefault();
let coursesId = this.props.match.params.coursesId;
- let {is_public} = this.state
+ let {is_public,datatime} = this.state
// console.log(is_public)
if (coursesId != undefined) {
@@ -173,7 +173,7 @@ class CoursesNew extends Component {
// console.log('Received values of form: ', values);
- let {datatime} = this.state;
+
let url = "/courses/" + coursesId + ".json";
axios.put(url, {
course_list_name: values.course,
@@ -227,7 +227,7 @@ class CoursesNew extends Component {
// debugger
//新建
// console.log('Received values of form: ', values);
- let {datatime} = this.state;
+
let url = "/courses.json";
axios.post(url, {
course_list_name: values.course,
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
index 5f41cdefb..61ed59d7b 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
@@ -382,7 +382,7 @@ class ShixunhomeWorkItem extends Component{
实训详情
{this.props.isAdminOrCreator()?this.editname(discussMessage.name,discussMessage.homework_id)} className={"btn colorblue ml20 font-16"}>重命名:""}
{/*
选择你可能感兴趣的内容
diff --git a/public/react/src/modules/user/InterestpageMax.js b/public/react/src/modules/user/InterestpageMax.js index 8ed2580d7..a53c1bbe0 100644 --- a/public/react/src/modules/user/InterestpageMax.js +++ b/public/react/src/modules/user/InterestpageMax.js @@ -189,6 +189,11 @@ class InterestpageMax extends Component { if (response !== undefined) { // this.Jumptotheinterestpage(); // window.location.href = "/" + + if(response.data.message!==undefined){ + + return; + } this.setMyEduCoderModals() } @@ -255,15 +260,15 @@ class InterestpageMax extends Component {