<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>265654</bug_id>
          
          <creation_ts>2011-02-06 23:43:34 +0000</creation_ts>
          <short_desc>Score decreases incorrectly for songs when &quot;Stop playing after this track&quot; is on</short_desc>
          <delta_ts>2011-02-10 12:48:00 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>amarok</product>
          <component>Playlist</component>
          <version>2.4-GIT</version>
          <rep_platform>Compiled Sources</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>HI</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.4.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Armin Straub">mail</reporter>
          <assigned_to name="Amarok Bugs">amarok-bugs-null</assigned_to>
          <cc>123kash</cc>
    
    <cc>nhn</cc>
    
    <cc>teo</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin>2.4.1</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1084773</commentid>
    <comment_count>0</comment_count>
    <who name="Armin Straub">mail</who>
    <bug_when>2011-02-06 23:43:34 +0000</bug_when>
    <thetext>Version:           2.4-GIT (using KDE 4.6.0) 
OS:                Linux

If &quot;Stop playing after this track&quot; is selected, then the scores are updated incorrectly.

This happens because in this case, both slotAboutToFinish() and (shortly after) slotFinished() are called in EngineController.  Each of them calls m_currentTrack-&gt;finishedPlaying causing the score to get updated twice (which shouldn&apos;t happen because of the incremental way the score is computed).  Moreover, the second time around the playedFraction is incorrectly determined to be zero which causes the overall decrease in score.

Reproducible: Always

Steps to Reproduce:
Play a song, select &quot;Stop playing after this track&quot;, and wait until it is completely played (or skip to the end).  Let&apos;s assume the track has a playcount of 9 and a score of 96.

Actual Results:  
The song now has a score of 87.
(In the first step it gets a score of (9*96+100)/10 = 96 as it should, but then this is decreased to (10*96+0)/11 = 87.)

Expected Results:  
The song should get a score of (9*96+100)/10 = 96.4.

OS: Linux (x86_64) release 2.6.35-25-generic
Compiler: cc</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1085649</commentid>
    <comment_count>1</comment_count>
    <who name="Myriam Schweingruber">myriam</who>
    <bug_when>2011-02-09 10:01:28 +0000</bug_when>
    <thetext>Ouch, confirmed in current git</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1085735</commentid>
    <comment_count>2</comment_count>
    <who name="Sergey Ivanov">123kash</who>
    <bug_when>2011-02-09 13:37:52 +0000</bug_when>
    <thetext>Git commit ee4cb2b3c72880a9a4da83756770fcd0298bedc8 by Sergey Ivanov.
Committed on 09/02/11 at 13:32.
Pushed by ivanov into branch &apos;master&apos;.

Fixed track&apos;s statistics update in case of StopAfterCurrent playback mode (prevent double statistics change).
BUG: 265654

M  +2    -0    ChangeLog     
M  +0    -4    src/EngineController.cpp     

http://commits.kde.org/amarok/ee4cb2b3c72880a9a4da83756770fcd0298bedc8</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1085790</commentid>
    <comment_count>3</comment_count>
    <who name="Armin Straub">mail</who>
    <bug_when>2011-02-09 15:45:03 +0000</bug_when>
    <thetext>Many thanks for the quick attention!

I haven&apos;t had time to actually test the proposed fix, but it seems to me that it has a troublesome side effect: in case, a song is manually stopped by the user (so that slotAboutToFinish isn&apos;t called) the score is not going to be updated at all.  Or am I missing something?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1086240</commentid>
    <comment_count>4</comment_count>
    <who name="Sergey Ivanov">123kash</who>
    <bug_when>2011-02-10 12:45:02 +0000</bug_when>
    <thetext>When you stop track manually, Amarok calls stop() method which updates track statistics.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>