don't fail this query cause avg_time is 0

This commit is contained in:
Sam 2013-06-30 01:30:26 +10:00
parent e77c396a19
commit 7681ba0c32

View File

@ -298,6 +298,7 @@ class Topic < ActiveRecord::Base
FROM (SELECT topic_id, FROM (SELECT topic_id,
round(exp(avg(ln(avg_time)))) AS gmean round(exp(avg(ln(avg_time)))) AS gmean
FROM posts FROM posts
WHERE avg_time > 0 AND avg_time IS NOT NULL
GROUP BY topic_id) AS x GROUP BY topic_id) AS x
WHERE x.topic_id = topics.id") WHERE x.topic_id = topics.id")
end end