At least I nailed the problem, my feeble attempts to fix it have failed....
It will not be assimilated....
I couldn't understand why the sort order was oddly interrupted... I do now.
The links are selected, and the correct sort order is use. _THEN_ the alternate category links are selected, and the two HASH/Arrays merged.
# --------------------------------------------------------
# Merges two array refs into one link list.
#
my ($arr_a, $arr_b) = @_;
my @names = split /,/, $LINKS{build_sort_order};
my @fields = map { $LINKDB->position($_) - 1 } @names;
my @c = sort { lc join ("", @{$a}[@fields]) cmp lc join ("", @{$b}[@fields]) } @{$arr_b}, @{$arr_a};
return \@c;
}
It's this merger that screws it all up!!!
It works (apparantly) if you use a simple sort, but if you chose to sort by:
isNew DESC, Priority DESC, Rating DESC
the output is pseudo random.
I think the only solutions would be to extract them both into a temporary table (unordered is ok), then extract them again using the preferred sort order.
It will not be assimilated....
I couldn't understand why the sort order was oddly interrupted... I do now.
The links are selected, and the correct sort order is use. _THEN_ the alternate category links are selected, and the two HASH/Arrays merged.
Code:
sub build_sort_links { # --------------------------------------------------------
# Merges two array refs into one link list.
#
my ($arr_a, $arr_b) = @_;
my @names = split /,/, $LINKS{build_sort_order};
my @fields = map { $LINKDB->position($_) - 1 } @names;
my @c = sort { lc join ("", @{$a}[@fields]) cmp lc join ("", @{$b}[@fields]) } @{$arr_b}, @{$arr_a};
return \@c;
}
It's this merger that screws it all up!!!
It works (apparantly) if you use a simple sort, but if you chose to sort by:
isNew DESC, Priority DESC, Rating DESC
the output is pseudo random.
I think the only solutions would be to extract them both into a temporary table (unordered is ok), then extract them again using the preferred sort order.