dev_SaaS
hjm 6 years ago
commit d5a8f3a1dc

@ -77,7 +77,8 @@ class EcCoursesController < ApplicationController
end
calculation_data << {first_level: first_level, first_leval_data: first_leval_data}
end
render :json => {calculation_data: calculation_data, calculation_value: @year.calculation_value, course_ids: course_ids.uniq}
render :json => {calculation_data: calculation_data, calculation_value: @year.calculation_value, course_ids: course_ids.uniq,
is_manager: @template_major}
end
# 课程目标配置

@ -125,7 +125,8 @@ class EcMajorSchoolsController < ApplicationController
evaluation_methods_url: evaluation_methods_url,
competition_calculation_info_url: competition_calculation_info_url,
score_level_setting_url: score_level_setting_url,
example_major: example_major
example_major: example_major,
allow_visit: User.current.admin? || User.current.ec_school.present?,
}
end

@ -387,6 +387,14 @@ class EcYearsController < ApplicationController
new_egs.save!
# 记录新旧对应关系,为之后的中间表做记录
egs_record << [pre_egs.id, new_egs.id]
prev_ersvss = EcRequireSubVsStandard.where(:ec_graduation_subitem_id => pre_egs.id)
prev_ersvss.each do |prev_ersvs|
new_ersvss = EcRequireSubVsStandard.new
new_ersvss.attributes = prev_ersvs.attributes.dup.except("id", "ec_graduation_subitem_id")
new_ersvss.ec_graduation_subitem_id = new_egs.id
new_ersvss.save!
end
end
end
@ -397,12 +405,30 @@ class EcYearsController < ApplicationController
new_eto.attributes = pre_eto.attributes.dup.except("id", "ec_year_id")
new_eto.ec_year_id = ec_year.id
new_eto.save!
# 复制 "培养目标分项"
pre_eto.ec_training_subitems.try(:each) do |pre_ets|
new_ets = EcTrainingSubitem.new
new_ets.attributes = pre_ets.attributes.dup.except("id", "ec_training_objective_id")
new_ets.ec_training_objective_id = new_eto.id
new_ets.save!
# 复制 "毕业要去 vs 培养目标"
pre_ervsos = EcRequirementVsObjective.where(:ec_training_objective_id => pre_ets.id)
pre_ervsos.each do |ervso|
new_ervso = EcRequirementVsObjective.new
new_ervso.attributes = ervso.attributes.dup.except("id", "ec_training_objective_id", "ec_graduation_requirement_id")
new_ervso.ec_training_objective_id = new_ets.id
new_egr_id = -1
egr_record.each do |egr_id|
if egr_id[0] == ervso.ec_graduation_requirement_id
new_egr_id = egr_id[1]
end
end
raise("找不对应的毕业要求") if new_egr_id == -1
new_ervso.ec_graduation_requirement_id = new_egr_id
new_ervso.save!
end
end
end

@ -245,6 +245,8 @@ class User < Principal
has_many :ec_major_schools, :through => :ec_major_school_users
has_many :ec_major_school_users, :dependent => :destroy
has_many :ec_course_users
#####
scope :logged, lambda { where("#{User.table_name}.status <> #{STATUS_ANONYMOUS}") }
@ -344,6 +346,14 @@ class User < Principal
end
end
}
# 工程认证的学校
def ec_school
school_id = self.ec_school_users.pluck(:school_id).first ||
self.ec_major_schools.pluck(:school_id).first ||
(self.ec_course_users.first && self.ec_course_users.first.try(:ec_course).try(:ec_year).try(:ec_major_school).try(:school_id))
end
def challenge_tags
games = self.games.where(:id => self.experiences.map(&:container_id), :status => 2)
challenge_tags = ChallengeTag.where(:challenge_id => games.map(&:challenge_id)).where("name != ''")

@ -18,9 +18,10 @@
<li class="<%= params[:action] == "index" && params[:controller] == "courses" ? " active" : "" %>"><%= link_to "课堂", courses_path %></li>
<li class="<%= params[:action] == "index" && params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "竞赛", competitions_path %></li>
<li class="<%= params[:action] == "index" && params[:controller] == "forums" ? " active" : "" %>"><%= link_to "问答", forums_path %></li>
<% ec_user = EcSchoolUser.where(:user_id => User.current.id).first %>
<% if ec_user %>
<li class="<%= params[:controller] == "ecs" ? " active" : "" %>" id="ec_banner"><%= link_to "认证", department_ecs_path(:school_id => ec_user.school_id) %></li>
<% if User.current.ec_school.present? %>
<li class="<%= params[:controller] == "ecs" ? " active" : "" %>" id="ec_banner">
<%= link_to "认证", department_ecs_path(:school_id => User.current.ec_school) %>
</li>
<% end %>
</ul>
<div class="posi-search" id="posi-search" style="display: none">

Loading…
Cancel
Save