Browse Source

Recent jobs sorted to show most recent first.

Lacey Sanderson 9 years ago
parent
commit
1f3911220c
2 changed files with 22 additions and 0 deletions
  1. 20 0
      api/blast_ui.api.inc
  2. 2 0
      theme/blast_recent_jobs.tpl.php

+ 20 - 0
api/blast_ui.api.inc

@@ -427,6 +427,26 @@ function format_query_headers($file) {
 
 }
 
+/** 
+ * Sort recent blast jobs by the date they were submitted. 
+ * Ascending is in order of submission.
+ *
+ * THIS FUNCTION SHOULD BY USED BY USORT().
+ */
+function sort_blast_jobs_by_date_submitted_asc($a, $b) {
+  return ($a->date_submitted - $b->date_submitted);
+}
+
+/** 
+ * Sort recent blast jobs by the date they were submitted. 
+ * Descending is most recent first.
+ *
+ * THIS FUNCTION SHOULD BY USED BY USORT().
+ */
+function sort_blast_jobs_by_date_submitted_desc($a, $b) {
+  return ($b->date_submitted - $a->date_submitted);
+}
+
 /**
  * Generate an image of HSPs for a given hit.
  *          

+ 2 - 0
theme/blast_recent_jobs.tpl.php

@@ -7,6 +7,8 @@
 $recent_jobs = get_recent_blast_jobs($programs);
 if ($recent_jobs) {
 
+  usort($recent_jobs, 'sort_blast_jobs_by_date_submitted_desc');
+  
   print '<h2>Recent Jobs</h2>';
   
   $table = array(