[Bps-public-commit] r16383 - in sd/trunk/lib/App: . SD/CLI/Command/Ticket

jesse at bestpractical.com jesse at bestpractical.com
Sun Oct 19 18:45:04 EDT 2008


Author: jesse
Date: Sun Oct 19 18:45:03 2008
New Revision: 16383

Modified:
   sd/trunk/lib/App/SD.pm
   sd/trunk/lib/App/SD/CLI/Command/Ticket/Comments.pm
   sd/trunk/lib/App/SD/CLI/Command/Ticket/Search.pm
   sd/trunk/lib/App/SD/Model/Ticket.pm

Log:
* Added support for explicit ordering on milestones. 
* Added the concept of a 'default milestone

Modified: sd/trunk/lib/App/SD.pm
==============================================================================
--- sd/trunk/lib/App/SD.pm	(original)
+++ sd/trunk/lib/App/SD.pm	Sun Oct 19 18:45:03 2008
@@ -11,7 +11,8 @@
         default_status      => ['2F9E6509-4468-438A-A733-246B3061003E' => 'new' ],
         components          => ['6CBD84A1-4568-48E7-B90C-F1A5B7BD8ECD' => qw/core ui docs tests/],
         default_component   => ['0AEC922F-57B1-44BE-9588-816E5841BB18' => 'core'],
-        milestones          => ['1AF5CF74-A6D4-417E-A738-CCE64A0A7F71' => qw/alpha beta 1.0/]
+        milestones          => ['1AF5CF74-A6D4-417E-A738-CCE64A0A7F71' => qw/alpha beta 1.0/],
+        default_milestone   => ['BAB613BD-9E25-4612-8DE3-21E4572859EA' => 'alpha']
 };
 
 }

Modified: sd/trunk/lib/App/SD/CLI/Command/Ticket/Comments.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Ticket/Comments.pm	(original)
+++ sd/trunk/lib/App/SD/CLI/Command/Ticket/Comments.pm	Sun Oct 19 18:45:03 2008
@@ -1,5 +1,6 @@
 package App::SD::CLI::Command::Ticket::Comments;
 use Moose;
+
 extends 'Prophet::CLI::Command::Search';
 with 'Prophet::CLI::RecordCommand';
 with 'App::SD::CLI::Command';

Modified: sd/trunk/lib/App/SD/CLI/Command/Ticket/Search.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Ticket/Search.pm	(original)
+++ sd/trunk/lib/App/SD/CLI/Command/Ticket/Search.pm	Sun Oct 19 18:45:03 2008
@@ -8,21 +8,37 @@
     my $self = shift;
 
     # sort output by created date if user specifies --sort
-    if ($self->has_arg('sort')) {
+    if ( $self->has_arg('sort') ) {
+
         # some records might not have creation dates
         no warnings 'uninitialized';
-        $self->sort_routine( sub {
-                    my $records = shift;
-                    return $self->sort_by_prop( created => $records) } );
-    }
-    if ($self->has_arg('group')) {
-        $self->group_routine( sub {
-                    my $records = shift;
-                    return $self->group_by_prop( $self->arg('group') => $records) } )
+        $self->sort_routine(
+            sub {
+                my $records = shift;
+                return $self->sort_by_prop( created => $records );
+            }
+        );
     }
 
-
-
+    if ( $self->has_arg('group') ) {
+        $self->group_routine(
+            sub {
+                my $records = shift;
+                my $groups =  $self->group_by_prop( $self->arg('group') => $records );
+                if ($self->arg('group') eq 'milestone') {
+                    my $order = $self->app_handle->setting( label => 'milestones' )->get();
+                    my %group_hash = map { $_->{'label'} => $_->{'records'} } @$groups;
+                    my $sorted_groups = [ map { 
+                                
+                                    { label => $_, records => (delete $group_hash{$_} || []) }
+
+                                } @$order ];
+                    return [@$sorted_groups, (map { {label => $_, records => $group_hash{$_}}} keys %group_hash )];
+                }
+                return $groups;
+            }
+        );
+    }
 };
 
 # implicit status != closed

Modified: sd/trunk/lib/App/SD/Model/Ticket.pm
==============================================================================
--- sd/trunk/lib/App/SD/Model/Ticket.pm	(original)
+++ sd/trunk/lib/App/SD/Model/Ticket.pm	Sun Oct 19 18:45:03 2008
@@ -132,10 +132,10 @@
 =cut
 
 sub props_to_show {
-    ('id', 'summary', 'status', 'owner', 'created', 'due', 'creator', 'reported_by', 'original_replica')
+    ('id', 'summary', 'status', 'owner', 'created', 'due', 'creator', 'reported_by', 'milestone', 'original_replica')
 }
 
-=head2 props_not_to_edit
+=head2 immutable_props
 
 A pattern of props not to show in an editor (when creating or updating a
 ticket, for example). Could also be used to determine which props shouldn't be



More information about the Bps-public-commit mailing list