Merge remote-tracking branch 'origin/dev_aliyun' into dev_tj

merge aliyun
dev_forge
tangjiang 5 years ago
commit 951edd6d11

@ -21,7 +21,7 @@ class User < ApplicationRecord
VALID_EMAIL_REGEX = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/i
VALID_PHONE_REGEX = /^1\d{10}$/
# 身份证
VALID_NUMBER_REGEX = /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
VALID_NUMBER_REGEX = /(^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^([A-Z]\d{6,10}(\(\w{1}\))?)$)/
LOGIN_LENGTH_LIMIT = 30
MAIL_LENGTH_LMIT = 60

@ -1,16 +1,16 @@
class AddUniqIndexToExerciseAnswer < ActiveRecord::Migration[5.2]
def change
remove_index :exercise_answers, column: [:exercise_question_id, :user_id]
# remove_index :exercise_answers, column: [:exercise_question_id, :user_id]
#
# change_column_default :exercise_answers, :exercise_choice_id, from: nil, to: -1
# ExerciseAnswer.where(exercise_choice_id: nil).update_all(exercise_choice_id: -1)
change_column_default :exercise_answers, :exercise_choice_id, from: nil, to: -1
ExerciseAnswer.where(exercise_choice_id: nil).update_all(exercise_choice_id: -1)
sql = %Q(delete from exercise_answers where (exercise_question_id, user_id, exercise_choice_id) in
(select * from (select exercise_question_id, user_id, exercise_choice_id from exercise_answers group by exercise_question_id, user_id, exercise_choice_id having count(*) > 1) a)
and id not in (select * from (select min(id) from exercise_answers group by exercise_question_id, user_id, exercise_choice_id having count(*) > 1 order by id) b))
ActiveRecord::Base.connection.execute sql
add_index :exercise_answers, [:exercise_question_id, :user_id, :exercise_choice_id], name: 'exercise_choice_index', unique: true
# sql = %Q(delete from exercise_answers where (exercise_question_id, user_id, exercise_choice_id) in
# (select * from (select exercise_question_id, user_id, exercise_choice_id from exercise_answers group by exercise_question_id, user_id, exercise_choice_id having count(*) > 1) a)
# and id not in (select * from (select min(id) from exercise_answers group by exercise_question_id, user_id, exercise_choice_id having count(*) > 1 order by id) b))
# ActiveRecord::Base.connection.execute sql
#
# add_index :exercise_answers, [:exercise_question_id, :user_id, :exercise_choice_id], name: 'exercise_choice_index', unique: true
end

@ -1,16 +1,16 @@
class AddUniqIndexToPollVotes < ActiveRecord::Migration[5.2]
def change
remove_index :poll_votes, column: [:poll_question_id, :user_id]
change_column_default :poll_votes, :poll_question_id, from: nil, to: -1
PollVote.where(poll_answer_id: nil).update_all(poll_answer_id: -1)
sql = %Q(delete from poll_votes where (poll_question_id, user_id, poll_answer_id) in
(select * from (select poll_question_id, user_id, poll_answer_id from poll_votes group by poll_question_id, user_id, poll_answer_id having count(*) > 1) a)
and id not in (select * from (select min(id) from poll_votes group by poll_question_id, user_id, poll_answer_id having count(*) > 1 order by id) b))
ActiveRecord::Base.connection.execute sql
add_index :poll_votes, [:poll_question_id, :user_id, :poll_answer_id], name: 'poll_answer_index', unique: true
# remove_index :poll_votes, column: [:poll_question_id, :user_id]
#
# change_column_default :poll_votes, :poll_question_id, from: nil, to: -1
# PollVote.where(poll_answer_id: nil).update_all(poll_answer_id: -1)
#
# sql = %Q(delete from poll_votes where (poll_question_id, user_id, poll_answer_id) in
# (select * from (select poll_question_id, user_id, poll_answer_id from poll_votes group by poll_question_id, user_id, poll_answer_id having count(*) > 1) a)
# and id not in (select * from (select min(id) from poll_votes group by poll_question_id, user_id, poll_answer_id having count(*) > 1 order by id) b))
# ActiveRecord::Base.connection.execute sql
#
# add_index :poll_votes, [:poll_question_id, :user_id, :poll_answer_id], name: 'poll_answer_index', unique: true
end
end

@ -0,0 +1,5 @@
class AddIndexToExerciseAnswers < ActiveRecord::Migration[5.2]
def change
add_index :exercise_answers, [:exercise_question_id, :user_id], name: "index_on_question_id_user_id"
end
end

@ -0,0 +1,16 @@
class AddIndexToExerciseChoice < ActiveRecord::Migration[5.2]
def change
change_column_default :exercise_answers, :exercise_choice_id, from: nil, to: -1
ExerciseAnswer.where(exercise_choice_id: nil).update_all(exercise_choice_id: -1)
sql = %Q(delete from exercise_answers where (exercise_question_id, user_id, exercise_choice_id) in
(select * from (select exercise_question_id, user_id, exercise_choice_id from exercise_answers group by exercise_question_id, user_id, exercise_choice_id having count(*) > 1) a)
and id not in (select * from (select min(id) from exercise_answers group by exercise_question_id, user_id, exercise_choice_id having count(*) > 1 order by id) b))
ActiveRecord::Base.connection.execute sql
add_index :exercise_answers, [:exercise_question_id, :user_id, :exercise_choice_id], name: 'exercise_choice_index', unique: true
remove_index :exercise_answers, name: :index_on_question_id_user_id
end
end

@ -0,0 +1,15 @@
class AddIndexToPollAnswer < ActiveRecord::Migration[5.2]
def change
remove_index :poll_votes, column: [:poll_question_id, :user_id]
change_column_default :poll_votes, :poll_question_id, from: nil, to: -1
PollVote.where(poll_answer_id: nil).update_all(poll_answer_id: -1)
sql = %Q(delete from poll_votes where (poll_question_id, user_id, poll_answer_id) in
(select * from (select poll_question_id, user_id, poll_answer_id from poll_votes group by poll_question_id, user_id, poll_answer_id having count(*) > 1) a)
and id not in (select * from (select min(id) from poll_votes group by poll_question_id, user_id, poll_answer_id having count(*) > 1 order by id) b))
ActiveRecord::Base.connection.execute sql
add_index :poll_votes, [:poll_question_id, :user_id, :poll_answer_id], name: 'poll_answer_index', unique: true
end
end

File diff suppressed because one or more lines are too long

@ -74,9 +74,9 @@ class ShixunWorkReport extends Component {
}
}else {
// this.props.slowDownload(url)
this.props.showNotification(`正在下载中`);
window.open("/api"+url+'?export=true', '_blank');
//
// this.props.showNotification(`正在下载中`);
window.open("/api"+url+"?disposition=inline", '_blank');
this.setState({ isspinning: false })
}
}).catch((error) => {

@ -20,7 +20,6 @@ import Trialapplication from "../login/Trialapplication";
const $ = window.$;
const versionNum = '0001';
const timestamp = Date.parse(new Date());
// let _url_origin = getUrl()
let _url_origin='';
if(window.location.port === "3007"){
@ -36,14 +35,14 @@ if (!window['indexHOCLoaded']) {
// $('head').append($('<link rel="stylesheet" type="text/css" />')
// .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`));
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/css/edu-common.css?${timestamp}`));
.attr('href', `${_url_origin}/stylesheets/css/edu-common.css?1`));
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?${timestamp}`));
.attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?1`));
// index.html有加载
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?${timestamp}`));
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?1`));
// $('head').append($('<link rel="stylesheet" type="text/css" />')

@ -20,7 +20,6 @@ import Trialapplication from "../login/Trialapplication";
const $ = window.$;
const versionNum = '0001';
const timestamp = Date.parse(new Date());
// let _url_origin = getUrl()
let _url_origin='';
if(window.location.port === "3007"){
@ -36,14 +35,14 @@ if (!window['indexHOCLoaded']) {
// $('head').append($('<link rel="stylesheet" type="text/css" />')
// .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`));
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/css/edu-common.css?${timestamp}`));
.attr('href', `${_url_origin}/stylesheets/css/edu-common.css?1`));
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?${timestamp}`));
.attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?1`));
// index.html有加载
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?${timestamp}`));
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?1`));
// $('head').append($('<link rel="stylesheet" type="text/css" />')

Loading…
Cancel
Save