diff --git a/app/controllers/admin/registered_sites_controller.rb b/app/controllers/admin/registered_sites_controller.rb index ccc6d2e..4a0bd72 100644 --- a/app/controllers/admin/registered_sites_controller.rb +++ b/app/controllers/admin/registered_sites_controller.rb @@ -2,7 +2,7 @@ class Admin::RegisteredSitesController < OrbitAdminController before_action ->(module_app = @app_title) { set_variables module_app } def index - @registeredsites = RegisteredSite.all.order_by(sort) + @registeredsites = RegisteredSite.where(:not_viewed.ne=>true).order_by(sort) .with_categories(filters("category")) .with_tags(filters("tag")).desc(:created_at) @table_fields = table_fields @@ -47,7 +47,7 @@ class Admin::RegisteredSitesController < OrbitAdminController def get_select_box tags = @module_app.tags.map{|v| v} categories = @module_app.categories.enabled.map{|v| v} - sites = RegisteredSite.all.collect{|v1| [v1,v1.tags,v1.category]} + sites = RegisteredSite.where(:not_viewed.ne=>true).collect{|v1| [v1,v1.tags,v1.category]} @sites_order_by_tags = tags.map{|v| {v=>sites.select{|v1| v1[1].include? v}.map{|v2| v2[0]}}} @sites_order_by_tags << {'no_tag'=>sites.select{|v1| v1[1]== []}.map{|v2| v2[0]}} @sites_order_by_cats = categories.map{|v| {v=>sites.select{|v1| v1[2]== v}.map{|v2| v2[0]}}} @@ -160,10 +160,10 @@ class Admin::RegisteredSitesController < OrbitAdminController tp.status = 'running' tp.save Thread.new do - count = RegisteredSite.where(:is_hidden.ne=>true).count + count = RegisteredSite.where(:is_hidden.ne=>true, :not_viewed.ne=>true).count batch_l = (count/50.0).ceil (1..batch_l).each do |v| - sites = RegisteredSite.where(:is_hidden.ne=>true).sort_by{|v| v.id}[(v-1)*50..(v*50)] + sites = RegisteredSite.where(:is_hidden.ne=>true, :not_viewed.ne=>true).sort_by{|v| v.id}[(v-1)*50..(v*50)] sites.each do |site| begin update_status(site) @@ -442,7 +442,7 @@ class Admin::RegisteredSitesController < OrbitAdminController end end def bundle_update_remote_show - @registeredsites = RegisteredSite.all.order_by(sort) + @registeredsites = RegisteredSite.where(:not_viewed.ne=>true).order_by(sort) .with_categories(filters("category")) .with_tags(filters("tag")).desc(:created_at) @table_fields = table_fields_for_bundle_update @@ -504,7 +504,7 @@ class Admin::RegisteredSitesController < OrbitAdminController end @table_fields = table_fields - @registeredsites = RegisteredSite.all.order_by(sort) + @registeredsites = RegisteredSite.where(:not_viewed.ne=>true).order_by(sort) .with_categories(filters("category")) .with_tags(filters("tag")).desc(:created_at) @registeredsites = search_data(@registeredsites,[:title,:site_domain]).page(params[:page]).per(10) diff --git a/app/models/registered_site.rb b/app/models/registered_site.rb index cfb05d4..34c8eaa 100644 --- a/app/models/registered_site.rb +++ b/app/models/registered_site.rb @@ -14,6 +14,7 @@ class RegisteredSite field :site_confirmed, type: Boolean, :default => false field :confirmation_token field :is_hidden,type: Boolean,:default => false + field :not_viewed,type: Boolean,:default => false has_many :bundle_update_logs has_many :site_logs has_many :installed_modules diff --git a/app/views/admin/registered_sites/_bundle_update_remote_show.html.erb b/app/views/admin/registered_sites/_bundle_update_remote_show.html.erb index eb24188..db62443 100644 --- a/app/views/admin/registered_sites/_bundle_update_remote_show.html.erb +++ b/app/views/admin/registered_sites/_bundle_update_remote_show.html.erb @@ -12,7 +12,7 @@
<% @registeredsites.each_with_index do |site,index1| %> - <% status = site.is_hidden == true ? 'is_hidden' : site.bundle_update_logs.first.status + <% status = site.is_hidden == true ? 'is_hidden' : site.bundle_update_logs.first.status rescue '' if status == 'failed' status = 'error' elsif status == 'finish'