[evolvis-commits] r17535: [#1586] Sorting by priority on My Page // Now tasks and tracker items automatically sorted in priority descending

papel at evolvis.org papel at evolvis.org
Tue Sep 6 14:18:28 CEST 2011


Author: papel
Date: 2011-09-06 14:18:28 +0200 (Tue, 06 Sep 2011)
New Revision: 17535

Modified:
   branches/evolvis-pa/common/tracker/ArtifactsForUser.class.php
Log:
[#1586] Sorting by priority on My Page // Now tasks and tracker items automatically sorted in priority descending

Modified: branches/evolvis-pa/common/tracker/ArtifactsForUser.class.php
===================================================================
--- branches/evolvis-pa/common/tracker/ArtifactsForUser.class.php	2011-09-06 11:40:39 UTC (rev 17534)
+++ branches/evolvis-pa/common/tracker/ArtifactsForUser.class.php	2011-09-06 12:18:28 UTC (rev 17535)
@@ -72,6 +72,38 @@
 		return $artifacts;
 	}
 	
+	/**
+	*	getAssignedArtifacts	- Get the users's assigned artifacts
+	*	@return	Artifact[]	The array of Artifacts
+	*/
+	function &getAssignedArtifactsByGroup() {
+		return $this->getArtifactsFromSQLwithParams('SELECT * FROM artifact_vw av WHERE av.assigned_to=$1 AND av.status_id=1 ORDER BY av.group_artifact_id, av.priority DESC',
+							    array($this->User->getID())) ;
+								  
+	}
+	
+	/**	getAssignedArtifactGroups() - Gets all user's assigned Bugs ignoring the filter provided
+	 *	in getAssignedBugsByGroup(). methods could be merged in the future to one method with overloading
+	 *
+	 *	@return	Artifact[]	The array of ArtifactsGroups
+	 */
+	function &getAssignedArtifactBugsGroups() {
+		
+		//There is always a resolution for bugs.		
+		$select = "SELECT av.artifact_id, av.priority, av.summary, ae.element_id, ae.element_name, at.name, av.group_artifact_id FROM artifact_vw av";
+		$join = " INNER JOIN artifact_group_list at ON (av.group_artifact_id = at.group_artifact_id)".
+		" INNER JOIN artifact_extra_field_data ad ON (av.artifact_id = ad.artifact_id)" .
+		" INNER JOIN artifact_extra_field_elements ae ON (CAST(ad.field_data as Integer) = ae.element_id)" .
+		" INNER JOIN artifact_extra_field_list al ON (ad.extra_field_id = al.extra_field_id)";
+		$where = " WHERE al.field_name = 'Resolution' AND av.assigned_to=$1 AND at.datatype = 1 AND ae.element_id != 100 ORDER BY av.group_artifact_id, av.priority DESC";
+		//The attribute element_id has the value 100 automatically if not selected.
+		
+		$sqlQuery = $select . $join . $where;
+		
+		return $this->getArtifactsFromSQLwithParams($sqlQuery, array($this->User->getID())); 
+	}
+	
+	
 	/**	getAssignedBugsByGroup() - Get the users's assigned artifacts of a tracker, that have
 	 *  the datatype 1	
 	 *  @param array() $arrFilter;
@@ -115,9 +147,10 @@
 			}
 			
 			$where = substr($where, 0, -3);
+			$where .= " ORDER BY av.group_artifact_id, av.priority DESC";
 		} else {
 			array_push($params, $this->User->getID());
-			$where .= " al.field_name = 'Resolution' AND av.assigned_to=$1 AND at.datatype = 1 AND ae.element_id != 100";# ORDER BY av.priority DESC"; Add to sort by priority		
+			$where .= " al.field_name = 'Resolution' AND av.assigned_to=$1 AND at.datatype = 1 AND ae.element_id != 100 ORDER BY av.group_artifact_id, av.priority DESC"; #;# ORDER BY av.priority DESC"; Add to sort by priority		
 		}
 		//The attribute element_id has the value 100 automatically if not selected.
 		



More information about the evolvis-commits mailing list