Forum OpenACS Q&A: Ratings package status?

Collapse
Posted by Emmanuelle Raffenne on
Hi everybody,

I will need a rating service for a dotLRN-based project very soon. There's a "ratings" package in the repository that doesn't seem to have any activity since the 5.2 branch.

What is the status of this package? Would it be compatible with OpenACS >= 5.3?

Also it looks like that some work has been done at the 5.2 branch but never been merged back to HEAD. Anybody can confirm that?

Collapse
Posted by Dave Bauer on
I can't think of any reason it won't work with 5.3 or newer. We are using it on a 5.2.0 site.

I am not sure if we have the changes that are on the 5.2 branch in that site or not.

Collapse
Posted by Robert Taylor on
it would be great to see this updated.

it's not used now but i can see it being used in the future.

Collapse
Posted by Emmanuelle Raffenne on
Hi,

So after having a closer look at the ratings package, it appears that the datamodel has been changed on oacs-5-2 adding "context_object_id". I think it has been done by Viaro (Viaro: can you confirm?). I understand that it would provide a way to group rated objects and get an average rating of the context (for example, a rate for a forum by computing the ratings given on threads). Is that correct? I didn't find anything in the API that uses it in that way though, or any other way actually except inserting the value in the table. So it makes me wonder if that work is finished.

Also, I've found duplicated procs in the API (5.2). Procs names are different but they basically do the same (it's the case for ratings::get and ratings::get_rating). Other should be reimplemented as includes (::dimension_form, ::form).

Finally, changes on oacs-5-2 have been done for postgresql only despite that the package has been written for both database on the first place. If we merge that work on HEAD, it would break oracle support (I didn't test on Oracle to check that the HEAD version is working though).

Collapse
Posted by Dave Bauer on
Let's ignore the unfinished work on 5.2 that is not compatible with Oracle.
Collapse
Posted by Don Baccus on
I don't see evidence that this package has ever supported Oracle. In my checkout of HEAD, at least, ratings/sql/oracle is empty.

And since it was written by Jeff Davis, who chose to personally ignore Oracle a year or so before he left the project, I'm sure that as committed by him it did not support Oracle.

Is there a port lying around that I'm missing?

Regarding the Viaro stuff, my feeling is to leave it out. The duplicate functionality sucks, and the fact that they've not maintained it by merging it to 5.3 and HEAD isn't a good sign either.

And I'm not sure I like the way they're trying to aggregate ratings together. For forums, of course, the right thing to do is to average ratings over messages with the forums' forum_id, NOT context_id. This kind of thing should be package-specific, with perhaps some ratings package help in the form of an API or the like (there is some help for aggregating ratings in Jeff's original code, it appears).

Collapse
Posted by Emmanuelle Raffenne on
In my checkout of HEAD, at least, ratings/sql/oracle is empty.

Ooops! Looking at what's inside the sql/oracle would have been a good idea... or cvs co -Pd :)

The "context_object_id" column is not fill automatically with the context_id of the object but with whatever is passed as context_object_id by the page that uses ratings. So if you use the ratings proc (should be an include btw), say, in forums package in the page that display 1 thread, you can pass the forum_id as context_object_id.

The aggregating stuff in Jeff's original code aggregates ratings by type of users (registered, anonymous, all), if I understood correctly the identifiers:

create table rating_aggregates (
dimension_id integer
constraint ratings_dimension_id_fk
references rating_dimensions(dimension_id) on delete cascade,
object_id integer
constraint ratings_object_id_fk
references acs_objects(object_id) on delete cascade
constraint ratings_object_id_nn
not null,
all_ratings integer,
all_rating_sum integer,
all_rating_ave float,
anon_ratings integer,
anon_rating_sum integer,
anon_rating_ave float,
reg_ratings integer,
reg_rating_sum integer,
reg_rating_ave float,
rated_on timestamptz,
constraint rating_aggregates_pk
primary key (object_id, dimension_id)
);

Regarding other Viaro's changes: the duplication of code can be cleaned up and I forgot to mention that they added scripts to view a summary (or details) of the ratings (by object, by user who rated), that can be interesting. The question is if those summaries should be restricted to users with admin privilege or not.

Collapse
Posted by Don Baccus on
Oh, I see, I thought you meant it was hard-wired for context_id.

Still seems a bit odd to me. Since it only supports PG, it would be easy enough to say "average the ratings for all the child objects of child forum_id" when you want to display that, and cache the result if you're worried about performance.

Anyway, it's not a dotlrn or core package obviously, so you guys at UNED should just do what you want, right?

Since Oracle support obviously is not an issue for this package :)

Collapse
Posted by Rocael Hernández Rizzardini on
Emma, regarding Miguel changes, I don't know the specifics, he is not with us anymore, and he worked that project for Malte IIRC.
Collapse
Posted by Eduardo Santos on
I am going to need this package also. Can I help in development somehow?
Collapse
Posted by Mario Aguado on
I'm going to migrate the package to oracle because I want add ratings to forums package, and also I'm going to translate this packages into spanish.

As changes are been made on branch 5.2. Should I do this work on that branch too?

Collapse
Posted by Emmanuelle Raffenne on
Hi Mario,

The 5.2 branch is "dead" so no, you don't have to do this work on that branch.

Thanks for taking on that.

Collapse
13: AJAX Ratings (response to 1)
Posted by Eduardo Santos on
Hi everyone,

As I told you before, I've been working in ratings package also, and right i got a fresh AJAX interface. The idea was to create a procedure that generates the HTML code that can be inserted on any page for any object you wnat to rate. It's based now on the package icons in a way that, when you click on the icon representing the rating, an AJAX Request automatically puts the results in the database.

If you want to take look, give me your opinion and some guidelines for future development, just take a look at the code:

http://svn.softwarepublico.gov.br/trac/openacs/browser/branches/mpv2/packages/ratings

One can also make an SVN checkout using the command:

svn co http://svn.softwarepublico.gov.br/svn/openacs/branches/mpv2/packages/ratings

There are basically three important procedures:

  • ratings::icon::get_info - Take the info about the images path and some other things (based on ratings::icon::get)
  • ratings::icon::html_fragment_new - Generate the html image output for the icons
  • ratings::ajax - Generate the AJAX complete form and HTML output

One can put the AJAX rating widget using the command ratings::ajax supplying the object_id to be rated. The version number was bumped to 0.2d because some dependencies changed (you must have ajaxhelper now).

Collapse
Posted by Jeff Lu on
Does anyone know how to use this package? I am trying to get the ratings/www/rate.tcl to work so I can rate acs_objects.