fix error for first open site

This commit is contained in:
chiu 2021-01-19 11:06:00 +08:00
parent 910f6edd9b
commit 589dc1adf2
1 changed files with 14 additions and 14 deletions

View File

@ -6,20 +6,7 @@ module Archive
require "#{ENV['PWD']}/app/models/category" require "#{ENV['PWD']}/app/models/category"
require "#{ENV['PWD']}/app/models/module_app" require "#{ENV['PWD']}/app/models/module_app"
OrbitApp.registration "Archive", :type => "ModuleApp" do tmp = OrbitApp.registration "Archive", :type => "ModuleApp" do
categories_temp = ModuleApp.where(:key => "archive").first.categories
categories_temp.each do |category|
archive_cat = ArchiveCategory.where(:category_id => category.id)
if archive_cat.count == 0
ArchiveCategory.create(category_id: category.id.to_s)
else
archive_cat[1..-1].each do |cat|
cat.delete
end
end
end
module_label "archive.archive" module_label "archive.archive"
base_url File.expand_path File.dirname(__FILE__) base_url File.expand_path File.dirname(__FILE__)
widget_methods ["widget","group_by_category"] widget_methods ["widget","group_by_category"]
@ -68,6 +55,19 @@ module Archive
:available_for => 'managers' :available_for => 'managers'
end end
end end
categories_temp = ModuleApp.where(:key => "archive").first.categories
categories_temp.each do |category|
archive_cat = ArchiveCategory.where(:category_id => category.id)
if archive_cat.count == 0
ArchiveCategory.create(category_id: category.id.to_s)
else
archive_cat[1..-1].each do |cat|
cat.delete
end
end
end
tmp
end end
end end
end end