Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1f6662b4

Von Sven Schöling vor mehr als 15 Jahren hinzugefügt

  • ID 1f6662b40914cbca0506545f3f2ccfa71c32b0c7
  • Vorgänger 066dbf0a
  • Nachfolger 32394d82

Bugfix: get_links_via behandelt jetzt korrekt, wenn der erste hop leer
ist.

Conflicts:

SL/RecordLinks.pm

Unterschiede anzeigen:

SL/RecordLinks.pm
use SL::Common;
use SL::DBUtils;
use Data::Dumper;
use List::Util qw(reduce);
sub create_links {
$main::lxdebug->enter_sub();
......
my $myconfig = \%main::myconfig;
my $form = $main::form;
my $last_hop = shift @hops;
my @links = undef;
my $last_hop = shift @hops;
my @links;
for my $hop (@hops) {
my @temp_links = $self->get_links(
......
to_id => $hop->{id},
);
if (@links) {
@links = grep { $_ }
cross {
if ( $a->{to_table} eq $b->{from_table}
&& $a->{to_id} eq $b->{from_id} ) {
+{ $a->{from_table}, $a->{from_id},
$b->{to_table}, $b->{to_table} }
}
} @links, @temp_links;
} else {
@links = @temp_links;
}
# short circuit if any of these are empty
return wantarray ? () : [] unless scalar @temp_links;
$last_hop = $hop;
push @links, \@temp_links;
$last_hop = $hop;
}
my $result = reduce {
[
grep { $_ }
cross {
if ( $a->{to_table} eq $b->{from_table}
&& $a->{to_id} eq $b->{from_id} ) {
+{ from_table => $a->{from_table},
from_id => $a->{from_id},
to_table => $b->{to_table},
to_id => $b->{to_id} }
}
} @{ $a }, @{ $b }
]
} @links;
$main::lxdebug->leave_sub();
return wantarray ? @links : \@links;
return wantarray ? @{ $result } : $result;
}
1;

Auch abrufbar als: Unified diff