diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7660c050..c9dc4fa2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -473,7 +473,11 @@ module ApplicationHelper def principals_check_box_tags_ex(name, principals) s = '' principals.each do |principal| - s << "\n" + if principal.has_attribute?(:userInfo) + s << "\n" + else + s << "\n" + end end s.html_safe end diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 048933e4..d41e6bd9 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -182,11 +182,12 @@ module WelcomeHelper sort_course_by_hot limit end + # modif by nwb def find_all_new_hot_course limit = 9 ,school_id = 0 #sort_project_by_hot_rails 1, 'course_ac_para DESC', limit time_now = Time.new.strftime("%Y"); - Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ? and #{Project.table_name}.created_on like '%#{time_now}%' and #{Project.table_name}.identifier not in - (select extra from courses where school_id = ?)", 1,school_id).order("course_ac_para DESC").limit(limit).all + Course.visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <> + ?", school_id).order("course_ac_para DESC").limit(limit).all end def find_all_hot_bid diff --git a/app/models/course.rb b/app/models/course.rb index 51b11867..ff5e4fbd 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -27,6 +27,7 @@ class Course < ActiveRecord::Base has_many :boards, :dependent => :destroy, :order => "position ASC" #has_many :course_journals_for_messages, :class_name => 'CourseJournalsForMessage', :as => :jour, :dependent => :destroy has_many :news, :dependent => :destroy, :include => :author + has_one :course_status, :class_name => "CourseStatus", :dependent => :destroy acts_as_taggable acts_as_nested_set :order => 'name', :dependent => :destroy diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index ce53924e..5ec76e4c 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -75,7 +75,7 @@