decidim-meetings/app/services/decidim/meetings/meeting_search.rb in decidim-0.0.4 vs decidim-meetings/app/services/decidim/meetings/meeting_search.rb in decidim-0.0.5

- old
+ new

@@ -18,12 +18,16 @@ query .where(localized_search_text_in(:title), text: "%#{search_text}%") .or(query.where(localized_search_text_in(:description), text: "%#{search_text}%")) end - # Handle the order_start_time filter - def search_order_start_time - query.order(start_time: order_start_time) + # Handle the date filter + def search_date + if options[:date] == "upcoming" + query.where("start_time >= ? ", Time.current).order("start_time ASC") + elsif options[:date] == "past" + query.where("start_time <= ? ", Time.current).order("start_time DESC") + end end # Handle the scope_id filter def search_scope_id query.where(decidim_scope_id: scope_id)