Subject:
PATCH: Fix recent activities
From:
Bernardo Innocenti <bernie@develer.com>
Date:
Tue, 28 Dec 2004 06:42:55 +0100
To:
ivo@achievo.org
CC:
achievo@achievo.org, Develer Staff ML <staff@lists.develer.com>
Message-ID:
<41D0F25F.4060302@develer.com>
User-Agent:
Mozilla Thunderbird (X11/20041216)
X-Accept-Language:
en-us, en
MIME-Version:
1.0
Content-Type:
text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding:
7bit

Hello,

this is a brutal fix for the query to retrieve the list of
recent activities.

Without fetching the entrydate field, non-distinct rows are
eliminated regardless of their date.  In some cases, older
activities appear before recent ones, making the recent list
completely useless.

Maybe this is even a MySQL 4.0/4.1 bug... or maybe not.
SQL is extremely vague, so I'm not sure whether the ORDER BY
clause should be applied before or after DISTINCT.


(by the way, did you get my previous patch?)



--- modules/project/attributes/class.projectphaseattrib.inc.orig	2004-12-13 11:10:05.000000000 +0100
+++ modules/project/attributes/class.projectphaseattrib.inc	2004-12-28 06:28:03.924335748 +0100
@@ -202,7 +202,7 @@ class atkProjectPhaseAttribute extends a
     
     $user = getUser();
      
-    $query = "SELECT DISTINCT phase.id, phase.name, project.name as projectname FROM project,phase,hours,project_person ";
+    $query = "SELECT DISTINCT phase.id, phase.name, project.name as projectname, hours.entrydate FROM project,phase,hours,project_person ";
     $query.= "WHERE phase.id=hours.phaseid AND userid='".$user["id"]."' AND phase.status='active' AND project.status='active' AND phase.projectid=project.id ";
     $query.= "AND project_person.projectid = project.id ";
     

-- // Bernardo Innocenti - Develer S.r.l., R&D dept. \X/ http://www.develer.com/ 