Merge branches 'dev_aliyun' and 'develop' of https://bdgit.educoder.net/Hjqreturn/educoder into develop

chromesetting
杨树明 5 years ago
commit 4583530dd1

@ -65,19 +65,20 @@ class Admins::ShixunSettingsController < Admins::BaseController
sheet1.row(0).default_format = blue
sheet1.row(0).concat(["实训ID","实训名称","技术平台", "Fork源", "实践任务","选择题任务","挑战人数", "通关人数", "状态","创建者", "单位", "职业", "关卡序号","关卡名称","技能标签"])
count_row = 1
shixuns.find_each do |shixun|
shixuns.includes(:fork_shixuns, :myshixuns, :mirror_repositories, challenges: [:challenge_tags], user: [user_extension: :school]).find_each do |shixun|
sheet1[count_row, 0] = shixun.identifier
sheet1[count_row, 1] = shixun.name
sheet1[count_row, 2] = shixun.shixun_main_name
sheet1[count_row, 2] = shixun.mirror_repositories.select{|mr| mr.main_type == "1"}.first&.type_name
sheet1[count_row, 3] = shixun.fork_identifier
sheet1[count_row, 4] = shixun.challenges.practice_type.count
sheet1[count_row, 5] = shixun.challenges.choose_type.count
sheet1[count_row, 6] = shixun.myshixuns.count
sheet1[count_row, 7] = shixun.myshixuns.finished.count
sheet1[count_row, 4] = shixun.challenges.select{|c| c.st == 0}.size
sheet1[count_row, 5] = shixun.challenges.select{|c| c.st == 1}.size
sheet1[count_row, 6] = shixun.myshixuns_count
sheet1[count_row, 7] = shixun.myshixuns.select{|m| m.status == 1}.size
sheet1[count_row, 8] = shixun.shixun_status
sheet1[count_row, 9] = shixun.owner.show_real_name
sheet1[count_row, 10] = shixun.owner.school_name
sheet1[count_row, 11] = shixun.owner.identity
sheet1[count_row, 9] = shixun.user.show_real_name
sheet1[count_row, 10] = shixun.user.school_name
sheet1[count_row, 11] = shixun.user.identity
shixun.challenges.each do |challenge|
sheet1[count_row, 12] = "#{challenge.position}"
sheet1[count_row, 13] = challenge.subject

@ -23,6 +23,7 @@ module Weapps::CoursesHelper
data = data.sort do |a, b|
[a[:letter]] <=> [b[:letter]]
end
data.push(data.shift) if data.select{|a|a[:letter]=='#'}.first.present? # '#'排在最后
return data
end
@ -49,6 +50,7 @@ module Weapps::CoursesHelper
data = data.sort do |a, b|
[a[:letter]] <=> [b[:letter]]
end
data.push(data.shift) if data.select{|a|a[:letter]=='#'}.first.present? # '#'排在最后
return data
end

@ -28,6 +28,7 @@ class Shixun < ApplicationRecord
has_one :first_tag_repertoire, through: :first_shixun_tag_repertoire, source: :tag_repertoire
has_many :homework_commons_shixuns, class_name: 'HomeworkCommonsShixun'
has_many :fork_shixuns, foreign_key: "fork_from", class_name: 'Shixun'
#实训的关卡
has_many :exercise_shixun_challenges, :dependent => :destroy
@ -97,7 +98,7 @@ class Shixun < ApplicationRecord
end
def fork_identifier
self.fork_from.nil? ? "--" : Shixun.where(id: self.fork_from).first.try(:identifier)
self.fork_from.nil? ? "--" : fork_shixuns.first&.identifier
end
def shixun_status
@ -171,7 +172,7 @@ class Shixun < ApplicationRecord
end
def owner
User.find(self.user_id)
User.find_by_id(self.user_id)
end
def shixun_main_name

@ -10,7 +10,7 @@ class Users::ApplyAuthenticationService < ApplicationService
raise Error, '请先完善基本信息' unless user.profile_completed?
Users::ApplyAuthenticationForm.new(params).validate!
raise Error, '您已经申请过实名认证了' if ApplyUserAuthentication.real_name_auth.processing.exists?(user_id: user.id)
# raise Error, '您已经申请过实名认证了' if ApplyUserAuthentication.real_name_auth.processing.exists?(user_id: user.id)
user.lastname = params[:name].to_s.strip
user.firstname = ''
@ -18,6 +18,8 @@ class Users::ApplyAuthenticationService < ApplicationService
user.show_realname = params[:show_realname].to_s == 'true' if params[:show_realname].to_s.present?
ActiveRecord::Base.transaction do
ApplyUserAuthentication.real_name_auth.processing.where(user_id: user.id).destroy_all
user.authentication = true
user.save!

@ -12,14 +12,14 @@ class Users::ApplyProfessionalAuthService < ApplicationService
raise Error, '请先完善基本信息' unless user.profile_completed?
Users::ApplyProfessionalAuthForm.new(params).validate!
raise Error, '您已经申请过职业认证了' if ApplyUserAuthentication.professional_auth.processing.exists?(user_id: user.id)
# raise Error, '您已经申请过职业认证了' if ApplyUserAuthentication.professional_auth.processing.exists?(user_id: user.id)
extension = user.user_extension
extension.school_id = params[:school_id]
extension.department_id = params[:department_id]
extension.identity = params[:identity]
user.professional_certification = extension.identity != 0
user.professional_certification = params[:identity] != "teacher"
extra = params[:extra].to_s.strip.presence
if extension.identity.to_s == 'student'
@ -31,6 +31,7 @@ class Users::ApplyProfessionalAuthService < ApplicationService
end
ActiveRecord::Base.transaction do
ApplyUserAuthentication.professional_auth.processing.where(user_id: user.id).destroy_all
user.save!
extension.save!

@ -27,7 +27,7 @@
<%= raw '<br/>' if weappImageExists %>
<%= javascript_void_link weappImageExists ? '重新上传' : '上传图片', class: 'action upload-shixun-weapp-image-action', data: { source_id: shixun.id, source_type: 'Shixun', suffix: '_weapp', toggle: 'modal', target: '.admin-upload-file-modal' } %>
</td>
<td><%= link_to shixun.owner.try(:real_name),"/users/#{shixun.owner.login}",target:'_blank' %></td>
<td><%= link_to shixun.owner.try(:real_name),"/users/#{shixun.owner&.login}",target:'_blank' %></td>
<td>
<% if shixun.status.to_i < 3 %>
<%= link_to "关闭", admins_shixun_setting_path(shixun,status:3,page_no:page_no),method: :put, :class => "", :remote => true %>

Loading…
Cancel
Save