Bug 172112

Summary: don't use 0 to denote unrated and unscored tracks
Product: [Applications] amarok Reporter: Caleb Cushing <xenoterracide>
Component: Collections/LocalAssignee: Amarok Developers <amarok-bugs-dist>
Status: CONFIRMED ---    
Severity: wishlist CC: caionnew, cycoone, karthik.periagaram, nidi
Priority: NOR    
Version: 2.3-GIT   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Caleb Cushing 2008-10-03 22:40:05 UTC
Version:           pre 2.0 beta (using Devel)
OS:                Linux
Installed from:    Compiled sources

0 is used to denote a unrated tracks. NULL should be used as null is not less than a rating of 5. this causes serious problems when creating playlists that basically asking for values greater than anything.
Comment 1 Seb Ruiz 2008-10-04 00:46:16 UTC
I don't understand what you are saying. Can you please provide an example?
Comment 2 Caleb Cushing 2008-10-04 20:19:56 UTC
when tracks are added to the database their rating is 0 it should be NULL.

if I tell amarok to not play tracks rated less than 2 it won't play anything I haven't rated either. because the database sees 0 as less than 2.

even though not rated is the same as saying we don't have a rating or don't have any information on a rating. null is the proper value for when you don't have information on something.

this problem has been present for several years.
Comment 3 Seb Ruiz 2008-11-08 12:57:58 UTC
*** Bug 174593 has been marked as a duplicate of this bug. ***
Comment 4 Karthik Periagaram 2009-03-29 01:09:43 UTC
This is because "rating" and score are variables (integer between 0-10, and float between 0-100 respectively) internally. Unrated songs do actually have a rating of 0 and the lowest rating you can assign to a song is 1 (0.5 stars).

The other option is perhaps have amarok assign an initial rating of 5 (2.5 stars) to all songs, which might not be such a good idea...For now, you could exclude songs between 0.5 and 2 stars and that will work...
Comment 5 Caleb Cushing 2009-03-29 01:16:00 UTC
that wouldn't work as the query would still see it as less than. you're proposing a 'hack' and not in a good way, the fix is to use nulls.
Comment 6 Stephen Baker 2009-12-02 04:18:29 UTC
A 'null' wouldn't have any relationship with > or < some number of stars.  If we take the SQL meaning it would always be false and never be selected by any star selection.

Semantics asside it might be nice to list unrated tracks as unrated, and have an option on dynamic playlists to include unrated tracks.
Comment 7 Stephen Baker 2009-12-02 04:20:20 UTC
To clarify my last remark, I mean to allow a selection like 5 star and unrated tracks; which is, I think, a reasonable use case.
Comment 8 Myriam Schweingruber 2009-12-02 09:41:31 UTC
You are welcome to give a hand :) Source code is on Gitorious: http://gitorious.org/amarok
Comment 9 Stephen Baker 2009-12-02 19:34:19 UTC
I haven't worked much with kdelibs/qt and I'm pretty swamped with work, but I'll take a look sometime between now and Sunday.