Path

ez projects / ezrating / forum / general / patch for postgresql


Patch for PostgreSQL

You need to be logged in to post messages in the forums. New users may register here.

chl

Member since:
08 September 2008

Posts: 2

Monday 08 September 2008 1:42:03 pm

Hello,
Thanks for this extension, it helped me quite a lot on my site.
Just one little catch, the 'AS' separator is still mandatory in a PostgreSQL Select statement, hence this little patch.

Also, if you have a few moments, could you explain me the
... AND o.published >= ALL (SELECT o1.published FROM...
in the same SQL query ?
For what I understand, it should always return the votes published after the latest revision of the object ? Because on PostgreSQL (again :), it returns only the last rate (but I may have been wrong somewhere)
My current site really was simple enough to just take all rates on an article but I'd like to understand in case I come accross something more elaborate :)

Thanks anyway !




--- ezratingoperator.php        2007-06-21 16:56:14.683367000 +0200


+++ ezratingoperator.php        2008-08-20 12:18:35.000000000 +0200


@@ -43,7 +43,7 @@


                include_once( 'lib/ezdb/classes/ezdb.php' );


                $db =& eZDB::instance();


 

-               $sql = "SELECT COUNT(a.data_int) reviewer_count, AVG(a.data_int) average_rating, MIN(a.data_int) min_rating, MAX(a.data_int) max_rating


+               $sql = "SELECT COUNT(a.data_int) AS reviewer_count, AVG(a.data_int) AS average_rating, MIN(a.data_int) AS min_rating, MAX(a.data_int) AS max_rating


                        FROM ezcontentobject_attribute a, ezcontentclass_attribute ca, ezcontentobject o, ezcontentobject_tree n


                        WHERE n.contentobject_id=o.id


                          AND n.parent_node_id=$nodeID


Up

chl

Member since:
08 September 2008

Posts: 2

Tuesday 09 September 2008 11:49:14 am

Oopsies, I didn't see your last commits, so sorry for the annoyance.

Actually, my project is nearly at end but the client wants some AJAX for the rating so I may post another useless patch some time :)
Up

Kristof Coomans

Member since:
12 February 2004

Posts: 68

Tuesday 23 September 2008 2:00:42 pm

The part



... AND o.published >= ALL (SELECT o1.published FROM...



ensures that only the last published review/rating object of an individual user is taken into account. So users can write a new review/rating, for example when there is a new release of the software, and only their last rating will be used.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Up

You need to be logged in to post messages in the forums. New users may register here.