[Git][noosfero/noosfero][master] 3 commits: pg-search-plugin: avoid occurrence registration loop

Rodrigo Souto gitlab at mg.gitlab.com
Thu Jul 6 17:00:10 BRT 2017


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
85c841df by Rodrigo Souto at 2017-06-21T15:20:08-03:00
pg-search-plugin: avoid occurrence registration loop

- - - - -
482761b0 by Rodrigo Souto at 2017-06-21T15:31:22-03:00
pg-search-plugin: load facets options when no facets is selected as well

- - - - -
950143a8 by Rodrigo Souto at 2017-07-06T19:59:54+00:00
Merge branch 'pg-search-fixes' into 'master'

Pg search fixes

See merge request !1249
- - - - -


1 changed file:

- plugins/pg_search/lib/pg_search_plugin.rb


Changes:

=====================================
plugins/pg_search/lib/pg_search_plugin.rb
=====================================
--- a/plugins/pg_search/lib/pg_search_plugin.rb
+++ b/plugins/pg_search/lib/pg_search_plugin.rb
@@ -40,9 +40,7 @@ class PgSearchPlugin < Noosfero::Plugin
       scope = query_scope.where(:id => scope.map(&:id)).reorder("")
     end
 
-    facets_params = facets.present? ? facets_options(asset, scope, facets) : {}
-
-    {:results => scope.paginate(paginate_options), :facets => facets_params, :periods => periods}
+    {:results => scope.paginate(paginate_options), :facets => facets_options(asset, scope, facets), :periods => periods}
   end
 
   private
@@ -208,7 +206,7 @@ class PgSearchPlugin < Noosfero::Plugin
       occurrence.value = argument
     when 'relation'
       klass_name = facet_slug.classify
-      occurrence.target = klass_name.constantize.find(argument)
+      occurrence.target = klass_name.constantize.where(id: argument).first
     else
       return
     end



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/1c535a1d60577495bffc4f3bd8e7a61d3335f25b...950143a806aed0f850a212ff0f4fe5eb3714c87a

---
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/1c535a1d60577495bffc4f3bd8e7a61d3335f25b...950143a806aed0f850a212ff0f4fe5eb3714c87a
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170706/1c5be485/attachment-0001.html>


More information about the Noosfero-dev mailing list