Changes for NTU General Affairs
This commit is contained in:
1 parent
d766eea9f4
commit
7c398ce4fe
73 files changed
+45400
-93
No files matched your search
@@ -320,6 +320,46 @@ namespace :migrate do
|
||||
bull.update_attribute(:available_for_zh_tw, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task :fix_imported_data => :environment do
|
||||
categories = BulletinCategory.where(key: /import_/).entries
|
||||
unless categories.blank?
|
||||
categories.each do |category|
|
||||
bulletins = category.bulletins
|
||||
unless bulletins.blank?
|
||||
bulletins.each do |bulletin|
|
||||
unless bulletin.bulletin_files.blank?
|
||||
file = bulletin.bulletin_files[0]
|
||||
bulletin.text_translations = file.description_translations
|
||||
bulletin.save
|
||||
file.update_attribute(:description, nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
categories = ArchiveFileCategory.where(key: /import_/).entries
|
||||
unless categories.blank?
|
||||
categories.each do |category|
|
||||
files = category.archive_files
|
||||
unless files.blank?
|
||||
files.each{|file| file.update_attributes({is_top: false, is_hot: false, is_hidden: false})}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task :delete_rss_announcement => :environment do
|
||||
categories = BulletinCategory.where(key: /rss_/).entries
|
||||
unless categories.blank?
|
||||
categories.each do |category|
|
||||
bulletins = category.bulletins
|
||||
unless bulletins.blank?
|
||||
bulletins.each(&:destroy)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task :fix_imported_rss => :environment do
|
||||
|
||||
Reference in new issue
Block a user