Index: project_usage.module
===================================================================
--- project_usage.module	(revision 533)
+++ project_usage.module	(working copy)
@@ -586,6 +586,22 @@
 }
 
 /**
+ * Return an array of the most active projects with the given taxonomy term.
+ *
+ * @return
+ *   An array of of the most active projects.  The array includes the node 
+ *   ID, the node title and the number of active installations.
+ */
+function project_usage_get_most_active_projects($tid, $limit = 5) {
+  $result = db_query('SELECT n.nid, n.title, pw.count FROM {node} n INNER JOIN {project_projects} pp ON n.nid = pp.nid INNER JOIN {project_usage_week_project} pw ON pp.nid = pw.nid INNER JOIN {term_node} tn ON tn.nid = pp.nid WHERE pw.timestamp = (SELECT MAX(timestamp) FROM {project_usage_week_project}) AND tn.tid = %d AND n.status = 1 ORDER BY pw.count DESC LIMIT %d', $tid, $limit);
+  $projects = array();
+  while ($project = db_fetch_object($result)) {
+    $projects[] = $project;
+  }
+  return $projecs;
+}
+
+/**
 * Implementation of hook_simpletest().
 */
 function project_usage_simpletest() {
