Changeset 20828

Show
Ignore:
Timestamp:
21.10.2009 15:06:47 (10 years ago)
Author:
kjdon
Message:

fixed a bug where when compacting, if the last bucket was retained as a bucket, then got an empty classification cos weren't testing whether the remaining oids were empty or not

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/classify/DateList.pm

    r20454 r20828  
    110110    $self->{'metadata'} = $self->strip_ex_from_metadata($self->{'metadata'}); 
    111111    $self->{'sort'} = $self->strip_ex_from_metadata($self->{'sort'}); 
    112  
     112  
    113113    # now can have comma separated list of Dates - we just use the first one (for now) 
    114114    my @meta_list = split(/,/, $self->{"metadata"}); 
     
    375375        $currentlastdate = $subsection; 
    376376    } else { 
    377  
    378377        if ($currentfirstdate eq $currentlastdate) { 
    379378        @{$compactedhash->{$currentfirstdate}} = @currentOIDs; 
     
    398397    # add final OIDs to last sub-classification if there aren't many otherwise 
    399398    # add final sub-classification 
    400     if ((scalar (@currentOIDs) < $min) && (scalar (@currentOIDs) > 0)) { 
    401     # want every thing in previous up to the dash 
    402     my ($newkey) = $lastkey =~ /^([^\-]+)/; 
    403     @currentOIDs = (@{$compactedhash->{$lastkey}}, @currentOIDs); 
    404     delete $compactedhash->{$lastkey}; 
    405     @{$compactedhash->{"$newkey-$currentlastdate"}} = @currentOIDs;  
    406     } else { 
    407     if ($currentfirstdate eq $currentlastdate) { 
    408         @{$compactedhash->{$currentfirstdate}} = @currentOIDs; 
     399    if (scalar (@currentOIDs) > 0) { 
     400    if ((scalar (@currentOIDs) < $min)) { 
     401         
     402        # want every thing in previous up to the dash 
     403        my ($newkey) = $lastkey =~ /^([^\-]+)/; 
     404        @currentOIDs = (@{$compactedhash->{$lastkey}}, @currentOIDs); 
     405        delete $compactedhash->{$lastkey}; 
     406        @{$compactedhash->{"$newkey-$currentlastdate"}} = @currentOIDs;  
    409407    } else { 
    410         @{$compactedhash->{"$currentfirstdate-$currentlastdate"}} = @currentOIDs; 
    411     }  
    412     } 
    413  
     408        if ($currentfirstdate eq $currentlastdate) { 
     409        @{$compactedhash->{$currentfirstdate}} = @currentOIDs; 
     410        } else { 
     411        @{$compactedhash->{"$currentfirstdate-$currentlastdate"}} = @currentOIDs; 
     412        }  
     413    } 
     414    } 
     415     
    414416    return $compactedhash; 
    415417}