Index: openacs-4/packages/forums/lib/forums/forums-chunk-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/Attic/forums-chunk-oracle.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/forums/lib/forums/forums-chunk-oracle.xql 4 Jun 2007 12:24:32 -0000 1.3 +++ openacs-4/packages/forums/lib/forums/forums-chunk-oracle.xql 15 Jun 2007 11:59:55 -0000 1.4 @@ -8,7 +8,7 @@ select forums_forums_enabled.*, approved_thread_count as n_threads, to_char(last_post, 'YYYY-MM-DD HH24:MI:SS') as last_post_ansi, - $unread_or_new_query + $unread_or_new_query_clause from forums_forums_enabled where forums_forums_enabled.package_id = :package_id and ( @@ -20,4 +20,14 @@ + + + approved_thread_count-nvl((SELECT forums_reading_info_user.threads_read + FROM forums_reading_info_user + WHERE forums_reading_info_user.forum_id=forums_forums_enabled.forum_id + AND forums_reading_info_user.user_id=:user_id), 0) + as count_unread + + + Index: openacs-4/packages/forums/lib/forums/forums-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/Attic/forums-chunk-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/forums/lib/forums/forums-chunk-postgresql.xql 22 May 2007 09:42:08 -0000 1.3 +++ openacs-4/packages/forums/lib/forums/forums-chunk-postgresql.xql 15 Jun 2007 11:59:55 -0000 1.4 @@ -8,7 +8,7 @@ select forums_forums_enabled.*, approved_thread_count as n_threads, to_char(last_post, 'YYYY-MM-DD HH24:MI:SS') as last_post_ansi, - $unread_or_new_query + $unread_or_new_query_clause from forums_forums_enabled where forums_forums_enabled.package_id = :package_id and ( @@ -20,4 +20,15 @@ + + + approved_thread_count-coalesce((SELECT forums_reading_info_user.threads_read + FROM forums_reading_info_user + WHERE forums_reading_info_user.forum_id=forums_forums_enabled.forum_id + AND forums_reading_info_user.user_id=:user_id), 0) + as count_unread + + + + Index: openacs-4/packages/forums/lib/forums/forums-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/forums-chunk.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/forums/lib/forums/forums-chunk.tcl 12 Jun 2007 07:18:10 -0000 1.9 +++ openacs-4/packages/forums/lib/forums/forums-chunk.tcl 15 Jun 2007 11:59:55 -0000 1.10 @@ -20,16 +20,9 @@ set useReadingInfo [forum::use_ReadingInfo_p] if { $useReadingInfo } { - set unread_or_new_query { - approved_thread_count-COALESCE( - (SELECT forums_reading_info_user.threads_read - FROM forums_reading_info_user, forums_forums_enabled - WHERE forums_reading_info_user.forum_id=forums_forums_enabled.forum_id - AND forums_reading_info_user.user_id=:user_id),0) - as count_unread - } + set unread_or_new_query_clause [db_map unread_or_new_query] } else { - set unread_or_new_query { + set unread_or_new_query_clause { case when last_post > (current_date - interval '1' day) then 't' else 'f' end as new_p } }