[Git][noosfero/noosfero][master] 2 commits: Update Gem 'will_paginate' that contains fix Rails 4 distinct count with multiple fields

Antonio Terceiro gitlab at mg.gitlab.com
Thu Jan 28 16:54:30 BRST 2016


Antonio Terceiro pushed to branch master at Noosfero / noosfero


Commits:
c683f124 by Michel Felipe de Oliveira Ferreira at 2016-01-28T11:43:15-03:00
Update Gem 'will_paginate' that contains fix Rails 4 distinct count with multiple fields

- - - - -
7e0284a2 by Antonio Terceiro at 2016-01-28T18:54:04+00:00
Merge branch 'count_distinct_paginate' into 'master'

Count distinct - Multiple fields in paginate

Fix sql query error with `distinct` into a **COUNT()** database function with multiple fields. The problem was caused by the gem `will_paginate` on version **3.0.5**. In their new version **3.0.7** this bug was fixed!!

See merge request !777
- - - - -


2 changed files:

- Gemfile
- plugins/relevant_content/test/unit/relevant_content_block_test.rb


Changes:

=====================================
Gemfile
=====================================
--- a/Gemfile
+++ b/Gemfile
@@ -18,7 +18,7 @@ gem 'ruby-feedparser',          '~> 0.7'
 gem 'daemons',                  '~> 1.1'
 gem 'unicorn',                  '~> 4.8'
 gem 'nokogiri',                 '~> 1.6.0'
-gem 'will_paginate',            '~> 3.0.5.0'
+gem 'will_paginate',            '~> 3.0.7'
 gem 'pothoven-attachment_fu',   '~> 3.2.16'
 gem 'delayed_job'
 gem 'delayed_job_active_record'


=====================================
plugins/relevant_content/test/unit/relevant_content_block_test.rb
=====================================
--- a/plugins/relevant_content/test/unit/relevant_content_block_test.rb
+++ b/plugins/relevant_content/test/unit/relevant_content_block_test.rb
@@ -57,4 +57,24 @@ class RelevantContentBlockTest < ActiveSupport::TestCase
     end
   end
 
+  should 'check most voted articles from profile with relevant content block' do
+    community = fast_create(Community)
+    article = fast_create(Article, {:name=>'2 votes', :profile_id => community.id})
+    2.times{
+      person = fast_create(Person)
+      person.vote_for(article)
+    }
+    article = fast_create(Article, {:name=>'10 votes', :profile_id => community.id})
+    10.times{
+        person = fast_create(Person)
+        person.vote_for(article)
+    }
+
+    Box.create!(owner: community)
+    community.boxes[0].blocks << RelevantContentPlugin::RelevantContentBlock.new
+
+    data = Article.most_voted(community, 5)
+    assert_equal false, data.empty?
+  end
+
 end



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/55f4354924c2b1ef651f60911f0166763c756e7a...7e0284a226a9d99ccbf5d1624fd50db4cf497acc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160128/f62b577b/attachment-0001.html>


More information about the Noosfero-dev mailing list