lib/conceptql/nodes/casting_node.rb in conceptql-0.0.9 vs lib/conceptql/nodes/casting_node.rb in conceptql-0.1.0
- old
+ new
@@ -59,22 +59,22 @@
.where(criterion_type: uncastable_types.map(&:to_s))
.select_group(:person_id)
wheres << Sequel.expr(person_id: uncastable_person_ids)
end
- destination_type_id = type_id(my_type)
+ destination_type_id = make_type_id(my_type)
unless to_me_types.empty?
# For each castable type in the stream, setup a query that
# casts each type to a set of IDs, union those IDs and fetch
# them from the source table
castable_type_query = to_me_types.map do |source_type|
source_ids = db.from(stream_query)
.where(criterion_type: source_type.to_s)
.select_group(:criterion_id)
source_table = make_table_name(source_type)
- source_type_id = type_id(source_type)
+ source_type_id = make_type_id(source_type)
db.from(source_table)
.where(source_type_id => source_ids)
.select(destination_type_id)
end.inject do |union_query, q|
@@ -83,10 +83,10 @@
wheres << Sequel.expr(destination_type_id => castable_type_query)
end
unless from_me_types.empty?
from_me_types.each do |from_me_type|
- fk_type_id = type_id(from_me_type)
+ fk_type_id = make_type_id(from_me_type)
wheres << Sequel.expr(fk_type_id => db.from(stream_query).where(criterion_type: from_me_type.to_s).select_group(:criterion_id))
end
end
casting_query.where(wheres.inject(&:|))