api: backup: code reduction

had it lying around and did not felt condensed/code-golfed to me,
rather a bit more expressive (surely biased though)..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-11-17 15:57:50 +01:00
parent 0652096e2f
commit 5cc0c3a008

View File

@ -52,15 +52,12 @@ my $convert_to_schedule = sub {
my $starttime = $job->{starttime};
my $dow = $job->{dow};
return "$starttime" if !$job->{dow}; # dow is restrictive, so none means all days
# normalize as it could be a null-separated list previously
$dow = join(',', PVE::Tools::split_list($dow)) if defined($dow);
my $dow = join(',', PVE::Tools::split_list($job->{dow}));
if (!$dow || $dow eq ALL_DAYS) {
return "$starttime";
}
return "$dow $starttime";
return $dow eq ALL_DAYS ? "$starttime" : "$dow $starttime";
};
my $schedule_param_check = sub {