Index: openacs-4/packages/ratings/tcl/rating-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ratings/tcl/rating-procs.tcl,v
diff -u -r1.4.2.2 -r1.4.2.3
--- openacs-4/packages/ratings/tcl/rating-procs.tcl	29 Jul 2005 23:08:24 -0000	1.4.2.2
+++ openacs-4/packages/ratings/tcl/rating-procs.tcl	1 Aug 2005 06:13:09 -0000	1.4.2.3
@@ -344,6 +344,7 @@
 	append output "</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td>"
 	incr count
     }
+
     append output "</tr></table>"
     return $output
 }
@@ -371,7 +372,7 @@
 }
 
 ad_proc -public ratings::get_average {
-    -context_object_id:required
+    {-context_object_id ""}
     -object_id:required
     {-dimension_key ""}
 } {
@@ -388,7 +389,11 @@
 } {
     set extra_query ""
     if { ![empty_string_p $dimension_key] } {
-	set extra_query "and dimension_id = ( select dimension_id from rating_dimensions where dimension_key = '$dimension_key' )"
+	append extra_query "and dimension_id = ( select dimension_id from rating_dimensions where dimension_key = '$dimension_key' )"
     }
+    if { ![empty_string_p $context_object_id] } {
+	append extra_query "and context_object_id = :context_object_id"
+    }
+
     return [db_string get_average_rating " "]
 }
Index: openacs-4/packages/ratings/tcl/rating-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ratings/tcl/Attic/rating-procs.xql,v
diff -u -r1.1.2.1 -r1.1.2.2
--- openacs-4/packages/ratings/tcl/rating-procs.xql	29 Jul 2005 23:09:10 -0000	1.1.2.1
+++ openacs-4/packages/ratings/tcl/rating-procs.xql	1 Aug 2005 06:13:09 -0000	1.1.2.2
@@ -32,8 +32,6 @@
 		ratings
 	where
 		object_id = :object_id
-	and	
-		context_object_id = :context_object_id
 	$extra_query
    </querytext>
 </fullquery>