-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Labels
Description
My biz team updates Deals with Notes quite frequently, but unfortunately it appears a note does not update the deal's updated_at value (e.g. a deal might be last updated May 24 even though someone added a note yesterday).
I tried sorting my array of deals based on the presence of a note, however this query is so unbelievably slow that the page times out every time:
session.deals.all(stage: :incoming).sort_by do |deal|
(deal.notes.all.present? && deal.notes.all.last[:updated_at]) ||
deal[:updated_at]
end
Any advice much appreciated!