From 9cf1de1880989b765c9f896b2867eca4a0e4f91d Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Wed, 8 May 2019 13:00:40 +0800
Subject: [PATCH 01/10] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...508045744_migrate_exercise_answer_score.rb | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 db/migrate/20190508045744_migrate_exercise_answer_score.rb
diff --git a/db/migrate/20190508045744_migrate_exercise_answer_score.rb b/db/migrate/20190508045744_migrate_exercise_answer_score.rb
new file mode 100644
index 00000000..3b639d92
--- /dev/null
+++ b/db/migrate/20190508045744_migrate_exercise_answer_score.rb
@@ -0,0 +1,20 @@
+class MigrateExerciseAnswerScore < ActiveRecord::Migration
+ def up
+ exercise = Exercise.where(:id => 1527).first
+ if exercise.present?
+ exercise.exercise_users.each do |exercise_user|
+ score = 0
+ exercise.exercise_questions.each do |question|
+ ExerciseShixunAnswer.where(exercise_question_id: question.id, user_id: exercise_user.user_id).each do |answer|
+ score += answer.score
+ end
+ end
+
+ exercise_user.update_attributes(objective_score: score, score: score)
+ end
+ end
+ end
+
+ def down
+ end
+end
From 31635eb93fe8bd677cfb1f95f80dac7e3ad8a238 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Sat, 11 May 2019 14:37:22 +0800
Subject: [PATCH 02/10] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E9=A2=98=E7=9A=84?=
=?UTF-8?q?=E8=A1=A8=E6=A0=BC=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/exercise/_exercise_student.html.erb | 2 +-
app/views/exercise/_exercise_student_result.html.erb | 2 +-
app/views/exercise/_show_MC.html.erb | 2 +-
app/views/exercise/_show_MCQ.html.erb | 2 +-
app/views/exercise/_show_multi.html.erb | 2 +-
app/views/exercise/_show_single.html.erb | 2 +-
app/views/exercise/student_exercise_list.html.erb | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/app/views/exercise/_exercise_student.html.erb b/app/views/exercise/_exercise_student.html.erb
index d361c200..add9d655 100644
--- a/app/views/exercise/_exercise_student.html.erb
+++ b/app/views/exercise/_exercise_student.html.erb
@@ -164,7 +164,7 @@
<% if exercise_question.question_type == 5 %>
diff --git a/app/views/exercise/_exercise_student_result.html.erb b/app/views/exercise/_exercise_student_result.html.erb
index b5336cdb..0dd656be 100644
--- a/app/views/exercise/_exercise_student_result.html.erb
+++ b/app/views/exercise/_exercise_student_result.html.erb
@@ -142,7 +142,7 @@
<% if exercise_question.question_type == 5 %>
<%= exercise_question.shixun.name %>
<% end %>
-
<%= sanitize exercise_question.question_title %>
+
<%= exercise_question.question_title.html_safe %>
<% case exercise_question.question_type %>
<% when 1 %>
diff --git a/app/views/exercise/_show_MC.html.erb b/app/views/exercise/_show_MC.html.erb
index 993369af..8461374a 100644
--- a/app/views/exercise/_show_MC.html.erb
+++ b/app/views/exercise/_show_MC.html.erb
@@ -15,7 +15,7 @@
<% end %>
-
<%= sanitize exercise_question.question_title%>
+
<%= exercise_question.question_title.html_safe%>
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
diff --git a/app/views/exercise/_show_MCQ.html.erb b/app/views/exercise/_show_MCQ.html.erb
index a778abb3..e1767b3b 100644
--- a/app/views/exercise/_show_MCQ.html.erb
+++ b/app/views/exercise/_show_MCQ.html.erb
@@ -15,7 +15,7 @@
<% end %>
-
<%= sanitize exercise_question.question_title %>
+
<%= exercise_question.question_title.html_safe %>
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
diff --git a/app/views/exercise/_show_multi.html.erb b/app/views/exercise/_show_multi.html.erb
index 2512123f..71623bf8 100644
--- a/app/views/exercise/_show_multi.html.erb
+++ b/app/views/exercise/_show_multi.html.erb
@@ -15,7 +15,7 @@
<% end %>
-
<%= sanitize exercise_question.question_title %>
+
<%= exercise_question.question_title.html_safe %>
参考答案:
diff --git a/app/views/exercise/_show_single.html.erb b/app/views/exercise/_show_single.html.erb
index 675ed49f..0c601f63 100644
--- a/app/views/exercise/_show_single.html.erb
+++ b/app/views/exercise/_show_single.html.erb
@@ -15,7 +15,7 @@
<% end %>
-
<%= sanitize exercise_question.question_title %>
+
<%= exercise_question.question_title.html_safe %>
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
候选答案<%= convert_to_chi_num(index+1) %>:
diff --git a/app/views/exercise/student_exercise_list.html.erb b/app/views/exercise/student_exercise_list.html.erb
index d47db23a..3632b4d7 100644
--- a/app/views/exercise/student_exercise_list.html.erb
+++ b/app/views/exercise/student_exercise_list.html.erb
@@ -259,7 +259,7 @@
<%= exercise_question.shixun.name %>
<% end %>
- <%= sanitize exercise_question.question_title %>
+ <%= exercise_question.question_title.html_safe %>
<% case exercise_question.question_type %>
<% when 1 %>
From 4b7d55cbef879e785fec2651f948f2d42c498aad Mon Sep 17 00:00:00 2001
From: Alec Zhou
Date: Sat, 11 May 2019 15:42:20 +0800
Subject: [PATCH 03/10] =?UTF-8?q?=E5=88=9B=E5=BB=BAopeni=E8=AE=B0=E5=BD=95?=
=?UTF-8?q?=E4=B9=8B=E5=90=8E=E5=BB=BA=E7=AB=8B=E8=B5=B7user=E4=B8=8Eopeni?=
=?UTF-8?q?=E4=B9=8B=E9=97=B4=E7=9A=84=E8=81=94=E7=B3=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/oauth_controller.rb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/controllers/oauth_controller.rb b/app/controllers/oauth_controller.rb
index 714bd610..f2a797b7 100644
--- a/app/controllers/oauth_controller.rb
+++ b/app/controllers/oauth_controller.rb
@@ -196,6 +196,8 @@ class OauthController < ApplicationController
UserExtensions.create!(user_id: user.id, school_id: School.first.id, identity: 4, gender: 0)
openi = Openi.create!(user_id: user.id, openi_user_id: openi_user_id, avatar_url: avatar_url, login: login, name: name, email: email)
+ openi.user = user
+ openi.save!
end
end
From aa6e3dddbfd2b2dac02c87826cf4fc551b8de6bd Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Mon, 13 May 2019 09:14:00 +0800
Subject: [PATCH 04/10] =?UTF-8?q?=E8=AF=95=E7=94=A8=E6=8E=88=E6=9D=83?=
=?UTF-8?q?=E6=9C=AA=E5=AE=A1=E6=89=B9=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E5=AD=A6=E6=A0=A1=E7=BB=9F=E8=AE=A1=E9=93=BE=E6=8E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/managements/_trial_authorization_list.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/managements/_trial_authorization_list.html.erb b/app/views/managements/_trial_authorization_list.html.erb
index 0e44ecfd..1a1a8791 100644
--- a/app/views/managements/_trial_authorization_list.html.erb
+++ b/app/views/managements/_trial_authorization_list.html.erb
@@ -15,7 +15,7 @@
<% if !user.try(:user_extensions).school_id.blank? && user.try(:user_extensions).try(:school) %>
- <%= user.try(:user_extensions).school.name %><%= user.try(:user_extensions).department ? ' - '+user.try(:user_extensions).department.name.to_s : '' %>
+ <%= user.try(:school_name) %><%= user.try(:user_extensions).department ? ' - '+user.try(:user_extensions).department.name.to_s : '' %>
<% end %>
<% if user.try(:user_extensions) && user.try(:user_extensions).identity %>
<%= user.identity %>
From dbaed7bc121ff38688aa2ea94092e1ea1e754f6f Mon Sep 17 00:00:00 2001
From: p31729568
Date: Mon, 13 May 2019 09:42:08 +0800
Subject: [PATCH 05/10] modify reject trial auth modal
---
.../_reject_authorization_model.html.erb | 32 ++++++++++++++++---
.../_trial_authorization_passed_list.html.erb | 4 ++-
2 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/app/views/managements/_reject_authorization_model.html.erb b/app/views/managements/_reject_authorization_model.html.erb
index 4d35359f..6d7468f4 100644
--- a/app/views/managements/_reject_authorization_model.html.erb
+++ b/app/views/managements/_reject_authorization_model.html.erb
@@ -51,15 +51,15 @@
-
+
-
-
+
+
@@ -79,8 +79,23 @@
var modal = $(".modal.reject-auth-modal");
var form = modal.find("#reject-auth-form");
var applyIdInput = form.find("input[name='apply_id']");
+ var rejectDescriptionSpan = form.find(".reject-description-label span");
+ var needRejectDescription = false;
var error = modal.find(".error");
+ modal.on("click", "input[name='reasons[]']", function(){
+ var checkbox = $(this);
+ if (checkbox.data("type") != "other") { return; }
+
+ if (checkbox.prop("checked")) {
+ needRejectDescription = true;
+ rejectDescriptionSpan.show();
+ } else {
+ needRejectDescription = false;
+ rejectDescriptionSpan.hide();
+ }
+ });
+
modal.on('click', '.submit-btn', function(){
if (!formValid()) { return; }
form.submit();
@@ -88,8 +103,13 @@
var formValid = function () {
error.html("").hide();
- if (form.find("input[name='reasons[]']:checked").length == 0 || form.find("textarea[name='reject_description']").val() == '') {
- error.html("原因和说明不能为空,请完善后再确认提交").show();
+ if (form.find("input[name='reasons[]']:checked").length == 0) {
+ error.html("撤销原因不能为空,请完善后再确认提交").show();
+ return false;
+ }
+
+ if (needRejectDescription && form.find("textarea[name='reject_description']").val() == '') {
+ error.html("备注说明不能为空,请完善后再确认提交").show();
return false;
}
@@ -100,6 +120,8 @@
applyIdInput.val('');
form.find("textarea[name='reject_description']").val('');
form.find("input[name='reasons[]']").each(function(){this.checked=false;})
+ needRejectDescription = false;
+ rejectDescriptionSpan.hide();
modal.hide();
};
// 隐藏弹窗
diff --git a/app/views/managements/_trial_authorization_passed_list.html.erb b/app/views/managements/_trial_authorization_passed_list.html.erb
index 6f31ffc6..bfaf91c2 100644
--- a/app/views/managements/_trial_authorization_passed_list.html.erb
+++ b/app/views/managements/_trial_authorization_passed_list.html.erb
@@ -38,7 +38,9 @@
<% if authorization.status == 2 %>
原因:<%= authorization.reason.blank? ? "空" : authorization.reason %>
- 备注说明:<%= authorization.reject_description.blank? ? "空" : authorization.reject_description %>
+ <% if authorization.reject_description.present? %>
+ 备注说明:<%= authorization.reject_description %>
+ <% end %>
<% end %>
From 8c3767cfa20c6da13f4013221a1b22ebf6e116c7 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Mon, 13 May 2019 10:38:05 +0800
Subject: [PATCH 06/10] fix my account page reject trial auth notify modal bug
---
app/views/my/account.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb
index e70c3555..5103d7f9 100644
--- a/app/views/my/account.html.erb
+++ b/app/views/my/account.html.erb
@@ -103,7 +103,7 @@
<% if @trail_authentication.status == 1 %>
sure_box_redirect_without_newtab("<%= user_path(@user) %>", "试用申请已被接受");
<% elsif @trail_authentication.status == 2 %>
- sure_box_redirect_without_newtab_btn("<%= my_account_path %>", "试用申请已被拒绝
原因:<%= @trail_authentication.reason %>", "重新申请");
+ sure_box_redirect_without_newtab_btn("<%= my_account_path %>", "试用申请已被拒绝
原因:<%= [@trail_authentication.reason, @trail_authentication.reject_description].join(';') %>", "重新申请");
<% end %>
<% end %>
From 39423255da3d2fd99220f55b01be44f689fd04aa Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Mon, 13 May 2019 11:09:34 +0800
Subject: [PATCH 07/10] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E6=8A=A5=E5=91=8A?=
=?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=8A=A5500?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/services/zip_service.rb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/services/zip_service.rb b/app/services/zip_service.rb
index b798e111..32846312 100644
--- a/app/services/zip_service.rb
+++ b/app/services/zip_service.rb
@@ -188,6 +188,7 @@ module ZipService
# file_name = "#{exercise.course_id}-#{exercise.exercise_name}-#{exercise_user.user.user_extensions.student_id}-#{exercise_user.user.show_real_name}" + ".pdf"
# file_name = "#{Time.now.strftime("%Y%m%d%H%M%S").to_s}-#{exercise.course_id}-#{exercise.id}-#{exercise_user.user.user_extensions.student_id}" + ".pdf"
file_name.gsub!(" ", "-")
+ file_name.gsub!("/", "_")
kit.to_file("#{OUTPUT_FOLDER}/#{file_name}")
out_file = "#{OUTPUT_FOLDER}/#{file_name}"
out_file
@@ -200,6 +201,7 @@ module ZipService
# file_name = "#{homework.course_id}-#{homework.name}-#{student_work.user.user_extensions.student_id}-#{student_work.user.show_real_name}" + ".pdf"
# file_name = "#{Time.now.strftime("%Y%m%d%H%M%S").to_s}-#{homework.course_id}-#{homework.id}-#{student_work.user.user_extensions.student_id}" + ".pdf"
file_name.gsub!(" ", "-")
+ file_name.gsub!("/", "_")
kit.to_file("#{OUTPUT_FOLDER}/#{file_name}")
out_file = "#{OUTPUT_FOLDER}/#{file_name}"
out_file
From 923d702d010ef9c0641028963185cc87811e5f64 Mon Sep 17 00:00:00 2001
From: Alec Zhou
Date: Mon, 13 May 2019 11:29:08 +0800
Subject: [PATCH 08/10] =?UTF-8?q?=E5=B0=86current=5Fuser=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E4=B8=BAUser.current?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/oauth_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/oauth_controller.rb b/app/controllers/oauth_controller.rb
index f2a797b7..780cc4ba 100644
--- a/app/controllers/oauth_controller.rb
+++ b/app/controllers/oauth_controller.rb
@@ -203,7 +203,7 @@ class OauthController < ApplicationController
self.logged_user = openi.user if openi.present? && openi.user.present?
original_url = params[:original_url]
- if current_user.logged?
+ if User.current.logged?
redirect_to original_url
else
redirect_to signin_path
From 8b7bce39bb74bf28dbec95a5b67b13220aaf2604 Mon Sep 17 00:00:00 2001
From: Alec Zhou
Date: Mon, 13 May 2019 14:51:28 +0800
Subject: [PATCH 09/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=91=E5=AE=9A?=
=?UTF-8?q?=E9=82=AE=E7=AE=B1=E7=9A=84=E9=93=BE=E6=8E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/subjects_helper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/helpers/subjects_helper.rb b/app/helpers/subjects_helper.rb
index 0a8d659f..6c5e240f 100644
--- a/app/helpers/subjects_helper.rb
+++ b/app/helpers/subjects_helper.rb
@@ -46,7 +46,7 @@ module SubjectsHelper
content = if (shixun.status == 2 && !shixun.hidden) || User.current.manager_of_shixun?(shixun)
content_before = "查看详情"
if User.current.try(:mail).blank?
- %Q{开始实战}
+ %Q{开始实战}
elsif shixun.challenges_count > 0
if is_modify.blank?
%Q{#{link_to '开始实战', shixun_exec_shixun_path(shixun, :is_subject => subject.id), :class => "btn_auto user_bluebg_btn fl none", :id => "shixun_operation", :target => "_blank"}}
From 01a9662ac2899e1a872ba9be6ff8a4111190d538 Mon Sep 17 00:00:00 2001
From: jasder
Date: Mon, 13 May 2019 16:09:10 +0800
Subject: [PATCH 10/10] =?UTF-8?q?FIX=20=E4=BF=AE=E5=A4=8D=E5=90=88?=
=?UTF-8?q?=E4=BD=9C=E4=BC=99=E4=BC=B4=E6=B7=BB=E5=8A=A0=E5=AE=A2=E6=88=B7?=
=?UTF-8?q?=E5=90=8E=EF=BC=8C=E4=B8=8E=E6=88=91=E7=9A=84=E8=8F=9C=E5=8D=95?=
=?UTF-8?q?=E4=B8=AD=20'=E5=AE=A2=E6=88=B7=E7=AE=A1=E7=90=86'=E5=88=97?=
=?UTF-8?q?=E8=A1=A8=E6=95=B0=E6=8D=AE=E4=B8=8D=E4=B8=80=E8=87=B4=E7=9A=84?=
=?UTF-8?q?bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index a1bc853b..775b1947 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -1267,7 +1267,8 @@ end
if school.present?
customer = Customer.new(school_id: s)
customer.save!
- PartnerCustomer.create(partner_id: partner_id,customer_id: customer.id )
+ PartnerCustomer.create!(partner_id: partner_id,customer_id: customer.id )
+ school.update_attributes(customer_id: customer.id)
end
end
render :json => {status: 1, message: "创建成功!"}