Ignore:
Timestamp:
11/02/15 11:33:11 (9 years ago)
Author:
nanardon
Message:

Add the ability to aggregate data in stat

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Objects.pm

    r1386 r1453  
    630630} 
    631631 
     632=head2 attributes_summary_by_object ($base, $attribute) 
     633 
     634Return list of peer object <=> values 
     635 
     636=cut 
     637 
     638sub attributes_summary_by_object { 
     639    my ($class, $base, $attribute) = @_; 
     640    my %values; 
     641    foreach my $id ($base->list_objects($class->type)) { 
     642        my $obj = $base->get_object($class->type, $id); 
     643        my $value = $obj->_get_c_field($attribute); 
     644        if ($value) { 
     645            if (ref $value) { 
     646                foreach (@$value) { 
     647                    push(@{ $values{ $id } }, $_); 
     648                } 
     649            } else { 
     650                push(@{ $values{ $id } }, $value); 
     651            } 
     652        } 
     653    } 
     654    return %values; 
     655} 
     656 
    632657=head2 find_next_numeric_id ($base, $field, $min, $max) 
    633658 
Note: See TracChangeset for help on using the changeset viewer.