Skip to content

Commit

Permalink
continue to speed up datacolumn#split_me? issue #288
Browse files Browse the repository at this point in the history
  • Loading branch information
manxingxing committed Jul 17, 2013
1 parent d0d31ab commit d69dfd6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/datacolumn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def split_me?
# This method returns true for a column when it requires splitting.
return false if self.approval_stage < 2
return false if %w{category text}.include? self.import_data_type
self.sheetcells.joins(:category).where(["categories.datagroup_id = ?", self.datagroup_id]).exists?
self.sheetcells.where(["category_id is not null and exists(select 1 from categories AS c where c.datagroup_id = ? and c.id = sheetcells.category_id)", self.datagroup_id]).exists?
end

# users of a datacolumn are those who are responsible for it
Expand Down

0 comments on commit d69dfd6

Please sign in to comment.