ratings and scores use 0 for default value

Caleb Cushing xenoterracide at gmail.com
Sun Nov 30 16:57:30 CET 2008


>  Probably, the fix is to either modify the schema or the query (so that
>  the query uses values of 0 as acceptable for all values > X).

that's sounds ugly.

>  The second one might be less intrusive and probably not that hard a fix
>  (Caleb, any help there?); the first fix would be more correct (unless it
>  would make our code more difficult elsewhere).

I would suggest generating statistics at db creation. without looking
at the db at all. the create table statement should be something like

create table statistics (
            track_id  int              primary key not null,
            rating     tinyint         default null,
            score      tinyint         default null,
           ...             ...                default null
);

this should (without my looking at any code) allow the removal of some
of the C++ since you'll no longer have to detect at playtime whether a
track has existing stats and handle it if it doesn't. I would also say
it allows you to remove code handling whether or not you have to
insert or update at that point, but since mysql supports upsert I'm
guessing that isn't an issue.

this solves problems with queries like

select tracks where not rating < 3;

I like to have queries like that because I figure that if I rated
something 1 I don't want to hear it.

unfortunately currently this query will result in only tracks that I
have rating > 3 and not any unrated tracks.
-- 
Caleb Cushing


More information about the Amarok-devel mailing list