Changeset 2973


Ignore:
Timestamp:
2002-02-19T22:15:04+13:00 (22 years ago)
Author:
sjboddie
Message:

Fixed a bug in the Hierarchy classifier

File:
1 edited

Legend:

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

    r2837 r2973  
    230230    $classifyinfo->{'Title'} = $title;
    231231    $classifyinfo->{'classifytype'} = $classifytype;
     232
    232233    return $classifyinfo;
    233234    }
    234235
    235236    $classifyinfo->{'contains'} = [] unless defined $classifyinfo->{'contains'};
    236    
    237     # add entries to the contains list until we have one for headOID
    238     #### the +10 is a hack that works but I'm not completely sure why
    239     #### and don't have time to delve deeper. one day someone should
    240     #### fix this ;-) -- Stefan
    241     while (scalar(@{$classifyinfo->{'contains'}}) <= ($headOID+10)) {
     237
     238    my $offset = 0;
     239    foreach $thing (@{$classifyinfo->{'contains'}}) {
     240    $offset ++ if defined $thing->{'OID'};
     241    }
     242   
     243    while (scalar(@{$classifyinfo->{'contains'}}) < ($headOID+$offset)) {
    242244    push (@{$classifyinfo->{'contains'}}, $self->get_entry("", $classifytype));
    243245    }
    244246
    245     return $self->get_OID_entry ($tailOID, $classifyinfo->{'contains'}->[($headOID-1)], $title, $classifytype);
     247    return $self->get_OID_entry ($tailOID, $classifyinfo->{'contains'}->[($headOID+$offset-1)], $title, $classifytype);
    246248}
    247249
Note: See TracChangeset for help on using the changeset viewer.