Commit 19e4dcc9 by John Donnal

bug fix

parent bfebc471
......@@ -71,7 +71,7 @@ module Joule
schema[:children].each do |child_schema|
child = db_folder.subfolders.find_by_joule_id(child_schema[:id])
if child.nil? # check to see if this folder has been moved from a different location
child = DbFolder.find_by_joule_id(child_schema[:id])
child = @db.db_folders.find_by_joule_id(child_schema[:id])
if not child.nil?
child.parent = db_folder
puts "moved #{child.name} to #{db_folder.name}"
......@@ -106,7 +106,7 @@ module Joule
schema[:streams].each do |stream_schema|
stream = db_folder.db_streams.find_by_joule_id(stream_schema[:id])
if stream.nil? # check to see if this stream has been moved from a different location
stream = DbStream.find_by_joule_id(stream_schema[:id])
stream = @db.db_streams.find_by_joule_id(stream_schema[:id])
if not stream.nil?
stream.db_folder = db_folder
puts "moved #{stream.name} to #{db_folder.name}"
......@@ -143,7 +143,7 @@ module Joule
schema[:event_streams].each do |stream_schema|
stream = db_folder.event_streams.find_by_joule_id(stream_schema[:id])
if stream.nil? # check to see if this stream has been moved from a different location
stream = EventStream.find_by_joule_id(stream_schema[:id])
stream = @db.event_streams.find_by_joule_id(stream_schema[:id])
if not stream.nil?
stream.db_folder = db_folder
puts "moved #{stream.name} to #{db_folder.name}"
......
......@@ -10,6 +10,8 @@ class Db < ApplicationRecord
dependent: :destroy
belongs_to :nilm
has_many :db_streams #flat map of all streams in database
has_many :db_folders
has_many :event_streams
#---Validations
validates :max_points_per_plot, numericality: { only_integer: true }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment