fix error

This commit is contained in:
chiu 2021-01-19 10:53:42 +08:00
parent 41e54c2f4d
commit 910f6edd9b
1 changed files with 13 additions and 12 deletions

View File

@ -6,19 +6,20 @@ 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"
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
OrbitApp.registration "Archive", :type => "ModuleApp" do 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"]