]> iEval git - gruntmaster-page.git/blobdiff - lib/Gruntmaster/Page/Generic.pm
Add distinct => 1 to problem list
[gruntmaster-page.git] / lib / Gruntmaster / Page / Generic.pm
index 36ca445a98c00c26ee4cae0b3b5190936d56d75d..9e07d4c8a68814aa11189b8a8f5a30e7d9390864 100644 (file)
@@ -63,8 +63,7 @@ sub entry {
        my ($thing, $lang, $env, $id) = @_;
        my %thing = %$thing;
        debug $env => "Rsname is $thing{rsname} and id is $id";
-       $thing{makers} //= sub { db(shift)->resultset($thing{rsname}) };
-       my %params = map {+ rs => $_, $_->get_columns } $thing{makers}->($env)->find($id);
+       my %params = map {+ rs => $_, $_->get_columns } db($env)->resultset($thing{rsname})->find($id);
        $thing{mangle}->(local $_ = \%params) if exists $thing{mangle};
        wantarray ? %params : \%params
 }
@@ -124,7 +123,7 @@ thing {
                my $db = db $env;
                return $db->problems->search({owner => $env->{'gruntmaster.user'}}) if exists $env->{'gruntmaster.user'};
                return $db->problems->search({'contest_problems.contest' => $env->{'gruntmaster.contest'}}, {join => 'contest_problems'}) if exists $env->{'gruntmaster.contest'};
-               $db->problems->search({-or => ['contest_problems.contest' => undef, 'contest.stop' => {'<=', time}], 'me.private' => 0}, {join => {'contest_problems' => 'contest'}});
+               $db->problems->search({-or => ['contest_problems.contest' => undef, 'contest.stop' => {'<=', time}], 'me.private' => 0}, {join => {'contest_problems' => 'contest'}, distinct => 1});
        };
        sortby { $a->{name} cmp $b->{name}};
        group { $_->{level} };
This page took 0.018096 seconds and 4 git commands to generate.