Check for a valid number of shares

This commit is contained in:
Eelco Dolstra 2015-08-12 15:36:55 +02:00
parent 006d105f93
commit 62cd9d18b6

View file

@ -220,6 +220,9 @@ sub updateJobset {
my $enabled = int($c->stash->{params}->{enabled});
die if $enabled < 0 || $enabled > 2;
my $shares = int($c->stash->{params}->{schedulingshares} // 1);
error($c, "The number of scheduling shares must be positive.") if $shares <= 0;
$jobset->update(
{ name => $jobsetName
, description => trim($c->stash->{params}->{"description"})
@ -232,7 +235,7 @@ sub updateJobset {
, keepnr => int(trim($c->stash->{params}->{keepnr}))
, checkinterval => int(trim($c->stash->{params}->{checkinterval}))
, triggertime => $enabled ? $jobset->triggertime // time() : undef
, schedulingshares => int($c->stash->{params}->{schedulingshares})
, schedulingshares => $shares
});
$jobset->project->jobsetrenames->search({ from_ => $jobsetName })->delete;