From 5cc0c3a008fd7134f90c6f5d160b1da296209623 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 17 Nov 2021 15:57:50 +0100 Subject: [PATCH] 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 --- PVE/API2/Backup.pm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/PVE/API2/Backup.pm b/PVE/API2/Backup.pm index 554dddf6..b1ad6afc 100644 --- a/PVE/API2/Backup.pm +++ b/PVE/API2/Backup.pm @@ -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 {