]> ruin.nu Git - ndwebbie.git/blobdiff - ND/Web/Pages/Forum.pm
trunc to seconds for thread listing
[ndwebbie.git] / ND / Web / Pages / Forum.pm
index 2b287a9d1193828485eef2d7f556e0d54f7f4afe..4aa72fec7ece06206f5e95516bbc1045c8f6c790 100644 (file)
@@ -92,7 +92,7 @@ sub render {
        }
 
        my $categories = $DBH->prepare(q{SELECT fcid AS id,category FROM forum_categories ORDER BY fcid});
-       my $threads = $DBH->prepare(q{SELECT ft.ftid AS id,ft.subject,count(NULLIF(COALESCE(fp.time > ftv.time,TRUE),FALSE)) AS unread,count(fp.fpid) AS posts, max(fp.time)::timestamp as last_post
+       my $threads = $DBH->prepare(q{SELECT ft.ftid AS id,ft.subject,count(NULLIF(COALESCE(fp.time > ftv.time,TRUE),FALSE)) AS unread,count(fp.fpid) AS posts, date_trunc('seconds',max(fp.time)::timestamp) as last_post
                FROM forum_threads ft JOIN forum_posts fp USING (ftid) LEFT OUTER JOIN (SELECT * FROM forum_thread_visits WHERE uid = $2) ftv ON ftv.ftid = ft.ftid
                WHERE ft.fbid = $1
                GROUP BY ft.ftid, ft.subject