Fix sync auto not deleting old data
This commit is contained in:
parent
1a79c2fed3
commit
aca97f85d8
|
@ -483,8 +483,7 @@ end
|
|||
def sync_conference_data_auto
|
||||
@user = User.all
|
||||
@user.each do |user|
|
||||
@conference_data = WritingConference.where(create_user_id: "#{user.id}")
|
||||
@conference_data.delete_all
|
||||
WritingConference.delete_all(conditions:{create_user_id: "#{user.id}"})
|
||||
# @user = User.find("#{params[:user_id]}")
|
||||
|
||||
# teachers.each do |hash|
|
||||
|
@ -563,8 +562,7 @@ end
|
|||
def sync_journal_paper_data_auto
|
||||
@user = User.all
|
||||
@user.each do |user|
|
||||
@journal_data = WritingJournal.where(create_user_id: "#{user_id}")
|
||||
@journal_data.delete_all
|
||||
WritingJournal.delete_all(conditions:{create_user_id: "#{user.id}"})
|
||||
# @user = User.find("#{params[:user_id]}")
|
||||
|
||||
# teachers.each do |hash|
|
||||
|
@ -632,7 +630,8 @@ def sync_journal_paper_data_auto
|
|||
@journal_paper.save!
|
||||
end
|
||||
end
|
||||
|
||||
puts "Sync "+u_account+"\r\n"
|
||||
sleep(5)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -640,8 +639,7 @@ end
|
|||
def sync_book_data_auto
|
||||
@user = User.all
|
||||
@user.each do |user|
|
||||
@books_data = WritingBook.where(create_user_id: "#{user_id}")
|
||||
@books_data.delete_all
|
||||
WritingBook.delete_all(conditions:{create_user_id: "#{user.id}"})
|
||||
# @user = User.find("#{params[:user_id]}")
|
||||
|
||||
# teachers.each do |hash|
|
||||
|
@ -736,73 +734,4 @@ end
|
|||
@bulletin.save!
|
||||
end
|
||||
end
|
||||
|
||||
# def get_page_data
|
||||
# f = File.open("/home/rwub/orbit-db/ntu_mb/pages/management_pages.xml")
|
||||
# page_xml = Nokogiri::XML(f)
|
||||
# #open("http://versatile.management.ntu.edu.tw/publication1/conference/#{ntuseq}.xml"))
|
||||
# @pages = page_xml.xpath("//management-page").map do |cp_node|
|
||||
# {
|
||||
# menu_title: (cp_node>"menu-title").text,
|
||||
# content: (cp_node>"content").text
|
||||
# }
|
||||
# end
|
||||
|
||||
# if @pages.present?
|
||||
# @i=0
|
||||
# @pages.each do |b|
|
||||
|
||||
# get_variables_for_new
|
||||
# @page = Page.new
|
||||
|
||||
# @page.parent = "4f45f3b9e9d02c5db900005d"
|
||||
# @page.design = "50ac424983e75219d2000021"
|
||||
# @page.theme_id = "50ac424a83e75219d2000025"
|
||||
# @page.menu_enabled_for= ["en", "zh_tw", ""]
|
||||
# @page.enabled_for= ["en", "zh_tw", ""]
|
||||
# @page.is_published = false
|
||||
# if b[:menu_title].blank?
|
||||
# @page.title = 'No Title Present'
|
||||
# @i += 1
|
||||
# @page.name = "#{@i}Page"
|
||||
# else
|
||||
# @i += 1
|
||||
# @page.title = b[:menu_title]
|
||||
# @page.name = "#{@i}Page"
|
||||
# end
|
||||
# if b[:content].blank?
|
||||
# @page.content = "No Content Present"
|
||||
# else
|
||||
# @page.content = b[:content]
|
||||
# end
|
||||
# @page.save!
|
||||
# end
|
||||
# else
|
||||
# puts "No Page Data"
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
# def get_variables_for_new
|
||||
# @designs = Design.all.entries
|
||||
# @themes = Design.first.themes
|
||||
# @module_apps = ModuleApp.for_frontend_select
|
||||
# @app_frontend_urls = nil
|
||||
# @categories = nil
|
||||
# @tags = nil
|
||||
# @page_frontend_data_counts = nil
|
||||
# @frontend_styles = nil
|
||||
# @selected={
|
||||
# :design => @designs.first,
|
||||
# :theme=> @themes.first,
|
||||
# :module_app=>nil,#@module_apps.first
|
||||
# :app_frontend_url=> nil, #@module_apps.first
|
||||
# :category=>nil,
|
||||
# :tag=>nil,
|
||||
# :page_frontend_data_count=>nil,
|
||||
# :frontend_style => nil
|
||||
# }
|
||||
# end
|
||||
|
||||
|
||||
end
|
||||
|
|
Reference in New Issue