Skip to content

Commit

Permalink
Fixing it to only use contained sections
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianAker committed Nov 15, 2002
1 parent c25ad6e commit dbdf02e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions utils/createTestSubmissions
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,11 @@ sub getRandomTopicID {

sub getRandomSection {
# Yes, inefficient. I do not care.
my $sections = $slashdb->sqlSelectColArrayref(
"section", "sections", undef, "ORDER BY id"
);
my $num = rand @{$sections};
my $sections = $slashdb->sqlSelectAll("section", "sections", "1=1 AND type='contained'", "ORDER BY RAND()");
my @sections = map { $_->[0] } @$sections;
my $num = rand @sections;
$num = 0 if rand(1) < 1/3;
my $rand_section = $sections->[$num];
my $rand_section = $sections[$num];
return $rand_section;
}

Expand Down

0 comments on commit dbdf02e

Please sign in to comment.