Fix problems with missing time values in display code

This commit is contained in:
Chris 2018-10-02 22:30:10 +01:00
parent 83950ff01b
commit 4198b66fc0
3 changed files with 5 additions and 3 deletions

View File

@ -73,7 +73,8 @@ sub _build_recipe {
});
}
my $time = ($recipe -> {"preptime"} + $recipe -> {"cooktime"}) * 60;
my $time = (($recipe -> {"preptime"} // 0) +
($recipe -> {"cooktime"} // 0) ) * 60;
return $self -> {"template"} -> load_template("list/recipe.tem",
{ "%(id)s" => $recipe -> {"id"},

View File

@ -71,7 +71,8 @@ sub _build_recipe {
});
}
my $time = ($recipe -> {"preptime"} + $recipe -> {"cooktime"}) * 60;
my $time = (($recipe -> {"preptime"} // 0) +
($recipe -> {"cooktime"} // 0) ) * 60;
return $self -> {"template"} -> load_template("search/recipe.tem",
{ "%(id)s" => $recipe -> {"id"},

View File

@ -159,7 +159,7 @@ sub _generate_view {
my $cooktime = $recipe -> {"cooktime"} ? $self -> {"template"} -> humanise_seconds($recipe -> {"cooktime"} * 60)
: "{L_VIEW_NOTSET}";
my $totaltime = $recipe -> {"preptime"} + $recipe -> {"cooktime"};
my $totaltime = ($recipe -> {"preptime"} // 0) + ($recipe -> {"cooktime"} // 0);
my $timereq = $totaltime ? $self -> {"template"} -> humanise_seconds($totaltime * 60)
: "{L_VIEW_NOTSET}";