Commit 47e82df35bc3e8e210349ab438172682987b0e80
1 parent
22a18175
Exists in
master
and in
23 other branches
ActionItem501: fixed some issues with production and staging environment
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2240 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
5 changed files
with
28 additions
and
14 deletions
Show diff stats
app/models/environment_finder.rb
| @@ -16,12 +16,16 @@ class EnvironmentFinder | @@ -16,12 +16,16 @@ class EnvironmentFinder | ||
| 16 | 16 | ||
| 17 | date_range = options.delete(:date_range) | 17 | date_range = options.delete(:date_range) |
| 18 | 18 | ||
| 19 | + # FIXME this test is in more than one place | ||
| 19 | if finder_method == 'paginate' | 20 | if finder_method == 'paginate' |
| 20 | options = {:page => 1, :per_page => options.delete(:limit)}.merge(options) | 21 | options = {:page => 1, :per_page => options.delete(:limit)}.merge(options) |
| 21 | end | 22 | end |
| 22 | 23 | ||
| 23 | if query.blank? | 24 | if query.blank? |
| 24 | - options = {:order => "#{asset_table(asset)}.name"}.merge(options) | 25 | + # FIXME this test is in more than one place |
| 26 | + if finder_method == 'paginate' | ||
| 27 | + options = {:order => "#{asset_table(asset)}.name"}.merge(options) | ||
| 28 | + end | ||
| 25 | if product_category && asset == :products | 29 | if product_category && asset == :products |
| 26 | @environment.send(asset).send(finder_method, :all, options.merge(:include => 'product_categorizations', :conditions => ['product_categorizations.category_id = (?)', product_category.id])) | 30 | @environment.send(asset).send(finder_method, :all, options.merge(:include => 'product_categorizations', :conditions => ['product_categorizations.category_id = (?)', product_category.id])) |
| 27 | elsif product_category && asset == :enterprises | 31 | elsif product_category && asset == :enterprises |
config/ferret_server.yml
db/migrate/044_create_product_categorizations.rb
| @@ -9,10 +9,16 @@ class CreateProductCategorizations < ActiveRecord::Migration | @@ -9,10 +9,16 @@ class CreateProductCategorizations < ActiveRecord::Migration | ||
| 9 | t.timestamps | 9 | t.timestamps |
| 10 | end | 10 | end |
| 11 | 11 | ||
| 12 | -# FIXME:uncomment after implementation | ||
| 13 | -# Product.find(:all).each do |p| | ||
| 14 | -# ProductCategorization.add_category_to_product(p.product_category, p) | ||
| 15 | -# end | 12 | + Product.find(:all).each do |p| |
| 13 | + if p.product_category | ||
| 14 | + ProductCategorization.add_category_to_product(p.product_category, p) | ||
| 15 | + print ".\0" | ||
| 16 | + else | ||
| 17 | + print "x\0" | ||
| 18 | + end | ||
| 19 | + $stdout.flush | ||
| 20 | + end | ||
| 21 | + print "\n" | ||
| 16 | 22 | ||
| 17 | end | 23 | end |
| 18 | 24 |
db/migrate/046_aggressive_indexing_strategy1.rb
| @@ -20,13 +20,13 @@ class AggressiveIndexingStrategy1 < ActiveRecord::Migration | @@ -20,13 +20,13 @@ class AggressiveIndexingStrategy1 < ActiveRecord::Migration | ||
| 20 | end | 20 | end |
| 21 | 21 | ||
| 22 | def self.down | 22 | def self.down |
| 23 | - add_index(:categories_profiles, :column => :profile_id) | ||
| 24 | - add_index(:categories_profiles, :column => :category_id) | ||
| 25 | - add_index(:product_categorizations, :column => :product_id) | ||
| 26 | - add_index(:product_categorizations, :column => :category_id) | ||
| 27 | - add_index(:products, :column => :enterprise_id) | ||
| 28 | - add_index(:profiles, :column => :environment_id) | ||
| 29 | - add_index(:blocks, :column => :box_id) | ||
| 30 | - add_index(:box, :column => [:owner_type, :owner_id]) | 23 | + remove_index(:categories_profiles, :column => :profile_id) |
| 24 | + remove_index(:categories_profiles, :column => :category_id) | ||
| 25 | + remove_index(:product_categorizations, :column => :product_id) | ||
| 26 | + remove_index(:product_categorizations, :column => :category_id) | ||
| 27 | + remove_index(:products, :column => :enterprise_id) | ||
| 28 | + remove_index(:profiles, :column => :environment_id) | ||
| 29 | + remove_index(:blocks, :column => :box_id) | ||
| 30 | + remove_index(:boxes, :column => [:owner_type, :owner_id]) | ||
| 31 | end | 31 | end |
| 32 | end | 32 | end |
lib/sqlite_extension.rb