diff --git a/app/controllers/hps_learnings_controller.rb b/app/controllers/hps_learnings_controller.rb index 2e583e5..9b72504 100644 --- a/app/controllers/hps_learnings_controller.rb +++ b/app/controllers/hps_learnings_controller.rb @@ -2,7 +2,7 @@ class HpsLearningsController < ApplicationController def index table_fields = ["hps_learning.course_pic", "hps_learning.title", :category, "hps_learning.runtime", "hps_learning.lectures"].collect{|x| {"head" => t(x.to_sym)}} classes = [] - HpsClass.all.desc(:created_at).each do |hpsclass| + HpsClass.filter_by_categories.desc(:created_at).each do |hpsclass| if hpsclass.hps_lectures.count > 0 thumb = hpsclass.course_pic.thumb.url.nil? ? "http://www.placehold.it/150x150/EFEFEF/AAAAAA" : hpsclass.course_pic.thumb.url classes << { diff --git a/app/views/admin/hps_learnings/index.html.erb b/app/views/admin/hps_learnings/index.html.erb index 39fd6c6..1a0477b 100644 --- a/app/views/admin/hps_learnings/index.html.erb +++ b/app/views/admin/hps_learnings/index.html.erb @@ -12,7 +12,7 @@ <% if !clas.course_pic.url.nil? %> <% else %> -   + <% end %> <%= clas.title %>