[Bps-public-commit] r10163 - in Net-Hiveminder: lib/Net

sartak at bestpractical.com sartak at bestpractical.com
Thu Dec 27 14:01:42 EST 2007


Author: sartak
Date: Thu Dec 27 14:01:41 2007
New Revision: 10163

Modified:
   Net-Hiveminder/   (props changed)
   Net-Hiveminder/lib/Net/Hiveminder.pm

Log:
 r49461 at onn:  sartak | 2007-12-27 14:00:05 -0500
 Add priority method; add priority to display_tasks


Modified: Net-Hiveminder/lib/Net/Hiveminder.pm
==============================================================================
--- Net-Hiveminder/lib/Net/Hiveminder.pm	(original)
+++ Net-Hiveminder/lib/Net/Hiveminder.pm	Thu Dec 27 14:01:41 2007
@@ -85,6 +85,9 @@
                 if $task->{$field};
         }
 
+        $display .= " [priority: " . $self->priority($task->{priority}) . "]"
+            if $task->{priority} != 3;
+
         my $helper = sub {
             my ($field, $name) = @_;
 
@@ -303,6 +306,25 @@
     close $handle;
 }
 
+=head2 priority (NUMBER | TASK) -> Maybe String
+
+Returns the "word" of a priority. One of: lowest, low, normal, high, highest.
+If the priority is out of range, C<undef> will be returned.
+
+=cut
+
+my @priorities = (undef, qw/lowest low normal high highest/);
+sub priority {
+    my $self = shift;
+    my $priority = shift;
+
+    # if they pass in a task, DTRT :)
+    $priority = $priority->{priority}
+        if ref($priority) eq 'HASH';
+
+    return $priorities[$priority];
+}
+
 =head1 SEE ALSO
 
 L<Jifty>, L<Net::Jifty>



More information about the Bps-public-commit mailing list