Commit f8fab09fc75fd97624f06c2816aa80979958c52e
1 parent
cf1e8aa6
Exists in
master
and in
27 other branches
Use true instead of 't' in SQL where clauses
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
db/migrate/20140709212646_add_spam_comments_counter_cache_to_articles.rb
@@ -3,7 +3,7 @@ class AddSpamCommentsCounterCacheToArticles < ActiveRecord::Migration | @@ -3,7 +3,7 @@ class AddSpamCommentsCounterCacheToArticles < ActiveRecord::Migration | ||
3 | add_column :articles, :spam_comments_count, :integer, :default => 0 | 3 | add_column :articles, :spam_comments_count, :integer, :default => 0 |
4 | add_column :article_versions, :spam_comments_count, :integer, :default => 0 | 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 | execute("UPDATE articles SET spam_comments_count = '#{data['comments_count']}' WHERE id = #{data['source_id']}") | 7 | execute("UPDATE articles SET spam_comments_count = '#{data['comments_count']}' WHERE id = #{data['source_id']}") |
8 | end | 8 | end |
9 | end | 9 | end |
plugins/statistics/lib/statistics_block.rb
@@ -94,7 +94,7 @@ class StatisticsBlock < Block | @@ -94,7 +94,7 @@ class StatisticsBlock < Block | ||
94 | 94 | ||
95 | def products | 95 | def products |
96 | if owner.kind_of?(Environment) | 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 | elsif owner.kind_of?(Enterprise) | 98 | elsif owner.kind_of?(Enterprise) |
99 | owner.products.count | 99 | owner.products.count |
100 | else | 100 | else |