diff --git a/lib/PostText/Model/Remark.pm b/lib/PostText/Model/Remark.pm index 2f67253..f5b98b2 100644 --- a/lib/PostText/Model/Remark.pm +++ b/lib/PostText/Model/Remark.pm @@ -44,8 +44,8 @@ sub create($self, $thread_id, $author, $body, $hidden = 0, $flagged = 0) { } sub count_for($self, $thread_id) { - $self->pg->db->query(<<~'END_SQL', $thread_id)->hash->{'count'} - SELECT COUNT(*) AS count + $self->pg->db->query(<<~'END_SQL', $thread_id)->hash->{'tally'} + SELECT COUNT(*) AS tally FROM remarks WHERE thread_id = ? AND NOT hidden_status; diff --git a/lib/PostText/Model/Thread.pm b/lib/PostText/Model/Thread.pm index 92285ec..c6dedba 100644 --- a/lib/PostText/Model/Thread.pm +++ b/lib/PostText/Model/Thread.pm @@ -60,8 +60,8 @@ sub last_page($self) { } sub count($self) { - $self->pg->db->query(<<~'END_SQL')->hash->{'count'} - SELECT COUNT(*) AS count + $self->pg->db->query(<<~'END_SQL')->hash->{'tally'} + SELECT COUNT(*) AS tally FROM threads WHERE NOT hidden_status; END_SQL