Fix bugs.

This commit is contained in:
BoHung Chiu 2021-03-04 19:09:06 +08:00
parent 5749b5c363
commit 4939a30b76
4 changed files with 5 additions and 5 deletions

View File

@ -177,7 +177,7 @@ class Admin::AcademicAdvisingsController < OrbitMemberController
end
def get_settings
@academic_advising_types = AdvisingType.all
@advising_types = AdvisingType.all
end
def set_plugin

View File

@ -97,7 +97,7 @@ module Admin::AcademicAdvisingsHelper
(year_start..year_end).each do |year|
# d1 = DateTime.new(year,1,1,0,0)
# d2 = DateTime.new(year,12,31,23,59)
t = jl.academic_advisings.where(:year => year.to_s, :member_profile_id.in => mps).count rescue 0
t = jl.advisings.where(:year => year.to_s, :member_profile_id.in => mps).count rescue 0
data["data"][year.to_s] = t
end
finaldata << data
@ -108,7 +108,7 @@ module Admin::AcademicAdvisingsHelper
# d2 = DateTime.new(year,12,31,23,59)
case type
when "category"
t = Advising.where(:year => year, :member_profile_id.in => mps, :academic_advising_type_id => nil).count rescue 0
t = Advising.where(:year => year, :member_profile_id.in => mps, :advising_type_id => nil).count rescue 0
end
data["data"][year.to_s] = t

View File

@ -4,7 +4,7 @@ class Advising
include OrbitModel::Status
include Slug
belongs_to :academic_advising_type
belongs_to :advising_type
belongs_to :member_profile
field :year, type: Integer

View File

@ -118,7 +118,7 @@
<div class="control-group big-group">
<label class="control-label muted"><%= t("academic_advising.academic_advising_category") %></label>
<div class="controls">
<%= f.select :academic_advising_type_id, @academic_advising_types.collect {|t| [ t.title, t.id ]} %>
<%= f.select :advising_type_id, @advising_types.collect {|t| [ t.title, t.id ]} %>
</div>
</div>