noosfero | Use true instead of 't' in SQL where clauses
Bráulio Bhavamitra
gitlab at gitlab.com
Wed Feb 11 09:17:27 BRST 2015
Bráulio Bhavamitra pushed to refs/heads/master at <a href="https://gitlab.com/noosfero/noosfero">Noosfero / noosfero</a>
Commits:
<a href="https://gitlab.com/noosfero/noosfero/commit/f8fab09fc75fd97624f06c2816aa80979958c52e">f8fab09f</a> by Braulio Bhavamitra
Use true instead of 't' in SQL where clauses
- - - - -
Changes:
=====================================
db/migrate/20140709212646_add_spam_comments_counter_cache_to_articles.rb
=====================================
--- a/db/migrate/20140709212646_add_spam_comments_counter_cache_to_articles.rb
+++ b/db/migrate/20140709212646_add_spam_comments_counter_cache_to_articles.rb
@@ -3,7 +3,7 @@ class AddSpamCommentsCounterCacheToArticles < ActiveRecord::Migration
add_column :articles, :spam_comments_count, :integer, :default => 0
add_column :article_versions, :spam_comments_count, :integer, :default => 0
- execute("SELECT comments.source_id as source_id, count(comments.id) as comments_count FROM comments LEFT OUTER JOIN articles ON articles.id = source_id WHERE comments.source_type = 'Article' AND comments.spam = 't' GROUP BY comments.source_id;").each do |data|
+ execute("SELECT comments.source_id as source_id, count(comments.id) as comments_count FROM comments LEFT OUTER JOIN articles ON articles.id = source_id WHERE comments.source_type = 'Article' AND comments.spam = true GROUP BY comments.source_id;").each do |data|
execute("UPDATE articles SET spam_comments_count = '#{data['comments_count']}' WHERE id = #{data['source_id']}")
end
end
=====================================
plugins/statistics/lib/statistics_block.rb
=====================================
--- a/plugins/statistics/lib/statistics_block.rb
+++ b/plugins/statistics/lib/statistics_block.rb
@@ -94,7 +94,7 @@ class StatisticsBlock < Block
def products
if owner.kind_of?(Environment)
- owner.products.where("profiles.enabled = 't' and profiles.visible = 't'").count
+ owner.products.where("profiles.enabled = true and profiles.visible = true").count
elsif owner.kind_of?(Enterprise)
owner.products.count
else
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150211/6bd1854f/attachment-0001.html>
More information about the Noosfero-dev
mailing list