Fix for data_migration
This commit is contained in:
parent
b2f28eabaf
commit
c951cc6b6f
|
@ -45,6 +45,7 @@ namespace :data_migration do
|
||||||
end
|
end
|
||||||
|
|
||||||
task :make_bulletins_and_news_has_language_flag => :environment do
|
task :make_bulletins_and_news_has_language_flag => :environment do
|
||||||
|
a = []
|
||||||
[Bulletin,NewsBulletin].each do |bulletin|
|
[Bulletin,NewsBulletin].each do |bulletin|
|
||||||
puts "="*10 + bulletin.to_s + "="*10
|
puts "="*10 + bulletin.to_s + "="*10
|
||||||
bulletin.all.each do |bt|
|
bulletin.all.each do |bt|
|
||||||
|
@ -52,10 +53,12 @@ namespace :data_migration do
|
||||||
"OK"
|
"OK"
|
||||||
else
|
else
|
||||||
'Failed'
|
'Failed'
|
||||||
|
a << bt.id
|
||||||
end
|
end
|
||||||
puts(bt.title+"----------#{result}")
|
puts((bt.title.to_s rescue '') + "----------#{result}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
p a
|
||||||
puts("#{'='*10}Finished#{'='*10}")
|
puts("#{'='*10}Finished#{'='*10}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ class Bulletin
|
||||||
|
|
||||||
def update_avliable_language
|
def update_avliable_language
|
||||||
VALID_LOCALES.each do |locale|
|
VALID_LOCALES.each do |locale|
|
||||||
unless title[locale].blank? || subtitle[locale].blank? || text[locale].blank?
|
if (title_translations[locale].blank? rescue true)
|
||||||
self["available_for_#{locale}".to_sym] = false
|
self["available_for_#{locale}".to_sym] = false
|
||||||
else
|
else
|
||||||
self["available_for_#{locale}".to_sym] = true
|
self["available_for_#{locale}".to_sym] = true
|
||||||
|
|
|
@ -205,7 +205,7 @@ class NewsBulletin
|
||||||
protected
|
protected
|
||||||
def update_avliable_language
|
def update_avliable_language
|
||||||
VALID_LOCALES.each do |locale|
|
VALID_LOCALES.each do |locale|
|
||||||
unless title[locale].blank? || subtitle[locale].blank? || text[locale].blank?
|
if (title_translations[locale].blank? rescue true)
|
||||||
self["available_for_#{locale}".to_sym] = false
|
self["available_for_#{locale}".to_sym] = false
|
||||||
else
|
else
|
||||||
self["available_for_#{locale}".to_sym] = true
|
self["available_for_#{locale}".to_sym] = true
|
||||||
|
|
Reference in New Issue