From f8fab09fc75fd97624f06c2816aa80979958c52e Mon Sep 17 00:00:00 2001 From: Braulio Bhavamitra Date: Wed, 11 Feb 2015 08:16:29 -0300 Subject: [PATCH] Use true instead of 't' in SQL where clauses --- db/migrate/20140709212646_add_spam_comments_counter_cache_to_articles.rb | 2 +- plugins/statistics/lib/statistics_block.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/20140709212646_add_spam_comments_counter_cache_to_articles.rb b/db/migrate/20140709212646_add_spam_comments_counter_cache_to_articles.rb index 8448e93..40819a1 100644 --- 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 diff --git a/plugins/statistics/lib/statistics_block.rb b/plugins/statistics/lib/statistics_block.rb index 3cab8f4..c74a564 100644 --- 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 -- libgit2 0.21.2