Commit f8fab09fc75fd97624f06c2816aa80979958c52e

Authored by Braulio Bhavamitra
1 parent cf1e8aa6

Use true instead of 't' in SQL where clauses

db/migrate/20140709212646_add_spam_comments_counter_cache_to_articles.rb
... ... @@ -3,7 +3,7 @@ class AddSpamCommentsCounterCacheToArticles < ActiveRecord::Migration
3 3 add_column :articles, :spam_comments_count, :integer, :default => 0
4 4 add_column :article_versions, :spam_comments_count, :integer, :default => 0
5 5  
6   - 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|
  6 + 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|
7 7 execute("UPDATE articles SET spam_comments_count = '#{data['comments_count']}' WHERE id = #{data['source_id']}")
8 8 end
9 9 end
... ...
plugins/statistics/lib/statistics_block.rb
... ... @@ -94,7 +94,7 @@ class StatisticsBlock < Block
94 94  
95 95 def products
96 96 if owner.kind_of?(Environment)
97   - owner.products.where("profiles.enabled = 't' and profiles.visible = 't'").count
  97 + owner.products.where("profiles.enabled = true and profiles.visible = true").count
98 98 elsif owner.kind_of?(Enterprise)
99 99 owner.products.count
100 100 else
... ...