From 3d18c208ca260de2b1073f876ee035337af00543 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Fri, 19 Dec 2014 00:28:20 +0100 Subject: [PATCH] Check the number and the max of votes before displaying the best moments. --- tpl/part/vote_table.tpl | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/tpl/part/vote_table.tpl b/tpl/part/vote_table.tpl index b9f9186..75408dd 100644 --- a/tpl/part/vote_table.tpl +++ b/tpl/part/vote_table.tpl @@ -1,3 +1,7 @@ +{if !is_array($best_moments) || empty($best_moments)} + {$best_moments = [0]} +{/if} +

{_('Votes of the poll')}

@@ -142,18 +146,20 @@ {* Line displaying best moments *} {$count_bests = 0} - - {_("Addition")} - {$max = max($best_moments)} - {foreach $best_moments as $best_moment} - {if $max == $best_moment} - {$count_bests = $count_bests +1} - {$max} - {else} - - {/if} - {/foreach} - + {$max = max($best_moments)} + {if $max > 0} + + {_("Addition")} + {foreach $best_moments as $best_moment} + {if $max == $best_moment} + {$count_bests = $count_bests +1} + {$max} + {else} + + {/if} + {/foreach} + + {/if}