From 5d9ad62cb3940986954c4ba48645fc1506f0ea82 Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Fri, 17 May 2013 23:07:27 +0000 Subject: mktreasurer: don't add duplicate entries in months array git-svn-id: svn+ssh://svn.mageia.org/svn/soft/mga-treasurer/trunk@8322 5b7c3c08-40e5-403b-9995-ace06908e4af --- mktreasurer | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mktreasurer b/mktreasurer index eafe58e..8501435 100755 --- a/mktreasurer +++ b/mktreasurer @@ -92,7 +92,8 @@ sub donations_infos { $res{by_month}->{$month}->{year} = $year; $res{by_month}->{$month}->{month} = $dt->month; push @{$res{by_year}->{$year}->{donations}}, $don; - push @{$res{by_year}->{$year}->{months}}, $month; + push @{$res{by_year}->{$year}->{months}}, $month + unless grep { $_ eq $month } @{$res{by_year}->{$year}->{months}}; push @{$res{by_pa}->{$don->{pa}}->{donations}}, $don; if (time - $don->{date} < '2592000') { # last 30 days $res{total_30} += $don->{amount}; @@ -128,7 +129,8 @@ sub transactions_infos { $res{by_month}->{$month}->{month} = $dt->month; $res{by_ac}->{$tra->{ac}}->{account} = $tra->{account}; push @{$res{by_year}->{$year}->{transactions}}, $tra; - push @{$res{by_year}->{$year}->{months}}, $month; + push @{$res{by_year}->{$year}->{months}}, $month + unless grep { $_ eq $month } @{$res{by_year}->{$year}->{months}}; push @{$res{by_pa}->{$tra->{pa}}->{transactions}}, $tra; push @{$res{by_ac}->{$tra->{ac}}->{transactions}}, $tra; if ($tra->{ca}) { -- cgit v1.2.1