Make sure that keywords are always returned in alphabetical order in the WikiMaster byKeyword view.

This commit is contained in:
Colin Kuskie 2010-08-09 19:27:45 -07:00
parent b5ef9fc9e7
commit b8917d4e57
2 changed files with 18 additions and 14 deletions

View file

@ -552,7 +552,11 @@ sub getKeywordHierarchy {
my $datum = {
title => $keyword, ##Note, same as keyword
url => $self->getUrl('func=byKeyword;keyword='.$keyword),
descendants => scalar @{ $assetKeyword->getMatchingAssets( { startAsset => $self, keyword => $keyword, }) },
descendants => scalar @{ $assetKeyword->getMatchingAssets( {
startAsset => $self,
keyword => $keyword,
sortOrder => 'Alphabetically',
}) },
};
##Prevent recursion if seen again
if (! $seen->{$keyword}++) {

View file

@ -155,30 +155,30 @@ my $tag_set2 = WebGUI::VersionTag->getWorking($session);
$tag_set2->commit;
WebGUI::Test->addToCleanup($tag_set2);
cmp_bag(
cmp_deeply(
$wiki->getKeywordHierarchy(),
[
{
title => 'criminals', url => '/testwiki?func=byKeyword;keyword=criminals',
children => bag(
superhashof({ title => 'red', }),
children => set(
superhashof({ title => 'andy', }),
superhashof({ title => 'red', }),
),
descendants => 0,
},
{
title => 'inmates', url => '/testwiki?func=byKeyword;keyword=inmates',
children => bag(
superhashof({ title => 'heywood', }),
children => set(
superhashof({ title => 'brooks', }),
superhashof({ title => 'heywood', }),
),
descendants => 0,
},
{
title => 'staff', url => '/testwiki?func=byKeyword;keyword=staff',
children => bag(
superhashof({ title => 'norton', }),
children => set(
superhashof({ title => 'hadley', }),
superhashof({ title => 'norton', }),
),
descendants => 0,
},
@ -194,22 +194,22 @@ my $tag_set3 = WebGUI::VersionTag->getWorking($session);
$tag_set3->commit;
WebGUI::Test->addToCleanup($tag_set3);
cmp_bag(
cmp_deeply(
$wiki->getKeywordHierarchy(),
[
superhashof({
title => 'criminals',
children => bag(
children => set(
superhashof({
title => 'andy',
children => bag(
children => set(
superhashof({
title => 'inmates',
children => bag(
children => set(
superhashof({ title => 'heywood', }),
superhashof({
title => 'brooks',
children => bag(
children => set(
superhashof({ title => 'criminals', }),
),
}),
@ -226,7 +226,7 @@ cmp_bag(
}),
superhashof({
title => 'staff',
children => bag(
children => set(
superhashof({ title => 'norton', }),
superhashof({ title => 'hadley', }),
),