From 896a47d9502fe6bcb79694a13f1a908d6eccc76b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 17 Apr 2012 09:34:35 +0000 Subject: [PATCH] Clear nrSucceeded when restarting a build --- src/lib/Hydra/Controller/Build.pm | 4 ++-- src/lib/Hydra/Helper/AddBuilds.pm | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index f9f1825a..b3442f02 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -351,9 +351,9 @@ sub restart : Chained('build') PathPart Args(0) { requireProjectOwner($c, $build->project); - my $drvpath = $build->drvpath ; + my $drvpath = $build->drvpath; error($c, "This build cannot be restarted.") - unless $build->finished && -f $drvpath ; + unless $build->finished && -f $drvpath; restartBuild($c->model('DB')->schema, $build); diff --git a/src/lib/Hydra/Helper/AddBuilds.pm b/src/lib/Hydra/Helper/AddBuilds.pm index c6c7703a..1e9bd0e7 100644 --- a/src/lib/Hydra/Helper/AddBuilds.pm +++ b/src/lib/Hydra/Helper/AddBuilds.pm @@ -968,5 +968,11 @@ sub restartBuild { , busy => 0 , locker => "" }); + + # Reset the stats for the evals to which this build belongs. + # !!! Should do this in a trigger. + foreach my $m ($build->jobsetevalmembers->all) { + $m->eval->update({nrsucceeded => undef}); + } }); }