From d305c5b6dfa1c80345dc959f33f7d90e4ec35d7f Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Tue, 5 Jan 2016 15:59:48 +0800 Subject: [PATCH] added first to query for the module timing --- .../admin/admin_modules_controller.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/admin/admin_modules_controller.rb b/app/controllers/admin/admin_modules_controller.rb index 113adf8..2dd68c3 100644 --- a/app/controllers/admin/admin_modules_controller.rb +++ b/app/controllers/admin/admin_modules_controller.rb @@ -125,16 +125,16 @@ class Admin::AdminModulesController < OrbitAdminController registered_sites = [] times = [] if !rm.nil? - rss = RegisteredSite.active - rss.each do |rs| - if access.nil? - im = InstalledModule.where(:r_module => rm.id, :registered_site_id => rs.id) - else - im = InstalledModule.where(:r_module => rm.id, :registered_site_id => rs.id,:permission_granted => access) - end - if im.count > 0 + rss = RegisteredSite.active + rss.each do |rs| + if access.nil? + im = InstalledModule.where(:r_module => rm.id, :registered_site_id => rs.id) + else + im = InstalledModule.where(:r_module => rm.id, :registered_site_id => rs.id,:permission_granted => access) + end + if im.count > 0 registered_sites << rs - times << im.created_at.strftime("%Y-%m-%d %H:%M") rescue "" + times << im.first.created_at.strftime("%Y-%m-%d %H:%M") rescue "" end end end