dev_ec
daiao 6 years ago
commit 542830b315

@ -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: "创建成功!"}

@ -196,12 +196,14 @@ 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
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

@ -46,7 +46,7 @@ module SubjectsHelper
content = if (shixun.status == 2 && !shixun.hidden) || User.current.manager_of_shixun?(shixun)
content_before = "<a href=\"#{shixun_path(shixun)}\" class=\"mr30 color-blue_4C shixun_detail pointer fl none\" target=\"_blank\">查看详情</a>"
if User.current.try(:mail).blank?
%Q{<a class="btn_auto user_bluebg_btn fl none" onclick="sure_box_redirect_without_newtab_btn('#{security_settings_path}', '开启实训,请先绑定邮箱','绑定邮箱');" id = "shixun_operation">开始实战</a>}
%Q{<a class="btn_auto user_bluebg_btn fl none" onclick="sure_box_redirect_without_newtab_btn('#{my_account_path}', '开启实训,请先绑定邮箱','绑定邮箱');" id = "shixun_operation">开始实战</a>}
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"}}

@ -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

@ -164,7 +164,7 @@
<% if exercise_question.question_type == 5 %>
<p class="pl15 pr15 mb10"><%= exercise_question.shixun.name %></p>
<% end %>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= sanitize exercise_question.question_title %></div>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= exercise_question.question_title.html_safe %></div>
<% case exercise_question.question_type %>
<% when 1 %>
<div class="pl15 pr15 mb15">

@ -142,7 +142,7 @@
<% if exercise_question.question_type == 5 %>
<p class="pl15 pr15 mb10"><%= exercise_question.shixun.name %></p>
<% end %>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= sanitize exercise_question.question_title %></div>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= exercise_question.question_title.html_safe %></div>
<% case exercise_question.question_type %>
<% when 1 %>
<div class="pl15 pr15 mb15">

@ -15,7 +15,7 @@
</p>
<% end %>
</div>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= sanitize exercise_question.question_title%></div>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= exercise_question.question_title.html_safe%></div>
<div class="pl15 pr15 mb10">
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<li class="clearfix">

@ -15,7 +15,7 @@
</p>
<% end %>
</div>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= sanitize exercise_question.question_title %></div>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= exercise_question.question_title.html_safe %></div>
<div class="pl15 pr15 mb10">
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<li class="clearfix">

@ -15,7 +15,7 @@
</p>
<% end %>
</div>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= sanitize exercise_question.question_title %></div>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= exercise_question.question_title.html_safe %></div>
<div class="clearfix bor-top-greyE padding15 answer_con">
<p>参考答案:</p>
<div class="justify font-14" style="padding: 0; padding-left: 10px;" id="exercise_answer_text_<%= exercise_question.id %>">

@ -15,7 +15,7 @@
</p>
<% end %>
</div>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= sanitize exercise_question.question_title %></div>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= exercise_question.question_title.html_safe %></div>
<div class="pl15 pr15 pt10 pb10 bor-top-greyE">
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
<span class="">候选答案<%= convert_to_chi_num(index+1) %></span>

@ -259,7 +259,7 @@
<p class="pl15 pr15 mb10"><%= exercise_question.shixun.name %></p>
<% end %>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word">
<%= sanitize exercise_question.question_title %>
<%= exercise_question.question_title.html_safe %>
</div>
<% case exercise_question.question_type %>
<% when 1 %>

@ -51,15 +51,15 @@
</span>
<span>
<input type="checkbox" name="reasons[]" value="其他" id="reject-reason-7" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<input type="checkbox" name="reasons[]" value="其他" id="reject-reason-7" data-type="other" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="reject-reason-7" class="color4C4C4C">其他</label>
</span>
</li>
<li class="clearfix mt10">
<label class="panel-form-label fl">备注说明:</label>
<textarea class="remarktextarea fl panel-box-sizing candiate_answer" name="reject_description" placeholder="为选择的撤销原因补充备注说明...."></textarea>
<label class="panel-form-label fl reject-description-label">备注说明<span class="color-red" style="display: none;">*</span></label>
<textarea class="remarktextarea fl panel-box-sizing candiate_answer" name="reject_description" placeholder="为选择的撤销原因补充备注说明(当选择原因“其他”,备注说明必填)..."></textarea>
</li>
<li class="ml20 error color-red" style="display: none;"></li>
@ -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();
};
// 隐藏弹窗

@ -15,7 +15,7 @@
</li>
<li class="clearfix mb5">
<% if !user.try(:user_extensions).school_id.blank? && user.try(:user_extensions).try(:school) %>
<span><%= user.try(:user_extensions).school.name %><%= user.try(:user_extensions).department ? ' - '+user.try(:user_extensions).department.name.to_s : '' %></span>
<a href="<%= user.try(:user_extensions).school.statistic_url %>" target="_blank" class="color-blue"><%= user.try(:school_name) %><%= user.try(:user_extensions).department ? ' - '+user.try(:user_extensions).department.name.to_s : '' %></a>
<% end %>
<% if user.try(:user_extensions) && user.try(:user_extensions).identity %>
<span class="ml30"><%= user.identity %></span>

@ -38,7 +38,9 @@
</li>
<% if authorization.status == 2 %>
<li><span class="color-red">原因:</span><span><%= authorization.reason.blank? ? "空" : authorization.reason %></span></li>
<li><span class="color-red">备注说明:</span><span><%= authorization.reject_description.blank? ? "空" : authorization.reject_description %></span></li>
<% if authorization.reject_description.present? %>
<li><span class="color-red">备注说明:</span><span><%= authorization.reject_description %></span></li>
<% end %>
<% end %>
</ul>
</div>

@ -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 %>", "试用申请已被拒绝<br/>原因:<%= @trail_authentication.reason %>", "重新申请");
sure_box_redirect_without_newtab_btn("<%= my_account_path %>", "试用申请已被拒绝<br/>原因:<%= [@trail_authentication.reason, @trail_authentication.reject_description].join('') %>", "重新申请");
<% end %>
<% end %>

@ -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
Loading…
Cancel
Save