From 4939a30b76bf468f01a89057b5e0ea2dc2a22dd0 Mon Sep 17 00:00:00 2001 From: bohung Date: Thu, 4 Mar 2021 19:09:06 +0800 Subject: [PATCH] Fix bugs. --- app/controllers/admin/academic_advisings_controller.rb | 2 +- app/helpers/admin/academic_advisings_helper.rb | 4 ++-- app/models/advising.rb | 2 +- app/views/admin/academic_advisings/_form.html.erb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin/academic_advisings_controller.rb b/app/controllers/admin/academic_advisings_controller.rb index 7f52464..2d4d81d 100644 --- a/app/controllers/admin/academic_advisings_controller.rb +++ b/app/controllers/admin/academic_advisings_controller.rb @@ -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 diff --git a/app/helpers/admin/academic_advisings_helper.rb b/app/helpers/admin/academic_advisings_helper.rb index 98f0d8c..933e38f 100644 --- a/app/helpers/admin/academic_advisings_helper.rb +++ b/app/helpers/admin/academic_advisings_helper.rb @@ -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 diff --git a/app/models/advising.rb b/app/models/advising.rb index 48a1b3b..4d7901f 100644 --- a/app/models/advising.rb +++ b/app/models/advising.rb @@ -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 diff --git a/app/views/admin/academic_advisings/_form.html.erb b/app/views/admin/academic_advisings/_form.html.erb index cc67967..309d660 100644 --- a/app/views/admin/academic_advisings/_form.html.erb +++ b/app/views/admin/academic_advisings/_form.html.erb @@ -118,7 +118,7 @@
- <%= 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 ]} %>