correct topic and category counting query
revive old styling that was stripped
This commit is contained in:
parent
25723de9c8
commit
614f45d003
|
@ -197,15 +197,42 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#topic-list tbody tr.has-excerpt .star {
|
||||||
#topic-list tbody tr.has-excerpt .star
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
margin-top: 3px;
|
margin-top: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#topic-list.categories {
|
||||||
|
th.latest, td.latest {
|
||||||
|
padding-left: 12px;
|
||||||
|
}
|
||||||
|
th.num {
|
||||||
|
width: 45px;
|
||||||
|
}
|
||||||
|
.last-user-info {
|
||||||
|
font-size: 12px;
|
||||||
|
margin-top: 3px;
|
||||||
|
}
|
||||||
|
tbody td {
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
.category{
|
||||||
|
position: relative;
|
||||||
|
width: 55%;
|
||||||
|
.featured-users {
|
||||||
|
position: absolute;
|
||||||
|
right: 18px;
|
||||||
|
top: 3px;
|
||||||
|
}
|
||||||
|
.category-description {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
.badge-category {
|
||||||
|
padding: 6px 10px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -114,8 +114,9 @@ class Category < ActiveRecord::Base
|
||||||
.visible
|
.visible
|
||||||
|
|
||||||
topics_with_post_count = Topic
|
topics_with_post_count = Topic
|
||||||
.select("topics.category_id, topics.id topic_id, COUNT(*) topic_count, SUM(topics.posts_count) post_count")
|
.select("topics.category_id, COUNT(*) topic_count, SUM(topics.posts_count) post_count")
|
||||||
.group("topics.category_id, topics.id")
|
.where("topics.id NOT IN (select cc.topic_id from categories cc)")
|
||||||
|
.group("topics.category_id")
|
||||||
.visible.to_sql
|
.visible.to_sql
|
||||||
|
|
||||||
topics_year = topics.created_since(1.year.ago).to_sql
|
topics_year = topics.created_since(1.year.ago).to_sql
|
||||||
|
@ -129,8 +130,7 @@ class Category < ActiveRecord::Base
|
||||||
post_count = x.post_count
|
post_count = x.post_count
|
||||||
FROM (#{topics_with_post_count}) x
|
FROM (#{topics_with_post_count}) x
|
||||||
WHERE x.category_id = c.id AND
|
WHERE x.category_id = c.id AND
|
||||||
(c.topic_count <> x.topic_count OR c.post_count <> x.post_count) AND
|
(c.topic_count <> x.topic_count OR c.post_count <> x.post_count)
|
||||||
x.topic_id <> c.topic_id
|
|
||||||
|
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue