[Git][noosfero/noosfero][api] 4 commits: Give the right certifiers list
Rodrigo Souto
gitlab at gitlab.com
Mon Jun 29 15:42:51 BRT 2015
Rodrigo Souto pushed to branch api at Noosfero / noosfero
Commits:
8b39ad22 by Aurélio A. Heckert at 2015-06-29T15:15:44Z
Give the right certifiers list
- - - - -
6709fd8f by Aurélio A. Heckert at 2015-06-29T15:15:55Z
Add test helper to compare hashes
- - - - -
aff3d549 by Aurélio A. Heckert at 2015-06-29T15:16:01Z
Find plugins on symlinks
- - - - -
6dbdae92 by Aurélio A. Heckert at 2015-06-29T15:16:06Z
Force hashfy
- - - - -
4 changed files:
- app/models/qualifier.rb
- lib/noosfero/api/entity.rb
- script/noosfero-plugins
- test/test_helper.rb
Changes:
=====================================
app/models/qualifier.rb
=====================================
--- a/app/models/qualifier.rb
+++ b/app/models/qualifier.rb
@@ -11,6 +11,12 @@ class Qualifier < ActiveRecord::Base
has_many :qualifier_certifiers, :dependent => :destroy
has_many :certifiers, :through => :qualifier_certifiers
+ def used_certs
+ Certifier.joins('INNER JOIN product_qualifiers' +
+ ' ON certifiers.id = product_qualifiers.certifier_id')
+ .where(product_qualifiers: {qualifier_id: self.id})
+ end
+
has_many :product_qualifiers, :dependent => :destroy
has_many :products, :through => :product_qualifiers, :source => :product
=====================================
lib/noosfero/api/entity.rb
=====================================
--- a/lib/noosfero/api/entity.rb
+++ b/lib/noosfero/api/entity.rb
@@ -14,6 +14,7 @@ class Noosfero::API::Entity < Grape::Entity
message: objects.message
}
else
+ data = data.serializable_hash if data.is_a? Noosfero::API::Entity
data.merge ok: true, error: { type: 'Success', message: '' }
end
else
=====================================
script/noosfero-plugins
=====================================
--- a/script/noosfero-plugins
+++ b/script/noosfero-plugins
@@ -17,7 +17,7 @@ fi
available_plugins_dir="$NOOSFERO_DIR/plugins"
enabled_plugins_dir="$NOOSFERO_DIR/config/plugins"
base_plugins_dir="$NOOSFERO_DIR/baseplugins"
-available_plugins=$(find "$available_plugins_dir" -maxdepth 1 -mindepth 1 -type d -not -name 'template' -printf '%f\n' | sort)
+available_plugins=$(find -L "$available_plugins_dir" -maxdepth 1 -mindepth 1 -type d -not -name 'template' -printf '%f\n' | sort)
enabled_plugins=$(find -L "$enabled_plugins_dir" -maxdepth 1 -mindepth 1 -type d -printf '%f\n' | sort)
base_plugins=$(find -L "$base_plugins_dir" -maxdepth 1 -mindepth 1 -type d -printf '%f\n' | sort)
=====================================
test/test_helper.rb
=====================================
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -270,6 +270,19 @@ module NoosferoTestHelper
''
end
+ # make a string from ordered hash to simplify tests
+ def h2s(value)
+ case value
+ when Hash, HashWithIndifferentAccess
+ '{'+ value.stringify_keys.to_a.sort{|a,b|a[0]<=>b[0]}.map{ |k,v| k+':'+h2s(v) }.join(',') +'}'
+ when Array
+ '['+ value.map{|i|h2s(i)}.join(',') +']'
+ when NilClass
+ '<nil>'
+ else value.to_s
+ end
+ end
+
end
class ActionController::IntegrationTest
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/9969f2f89bb23a635aa5ad4b870d041b8ae5cf15...6dbdae926759ffdefb9678b2c39208279a1057af
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150629/d791790a/attachment-0001.html>
More information about the Noosfero-dev
mailing list