From cc37917897820f8406a181d0d0980e75e95317fd Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Mon, 29 Feb 2016 03:03:46 +0100 Subject: [PATCH] [anciens_negatifs] passage en NK2015 --- bde/anciens_negatifs.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bde/anciens_negatifs.sh b/bde/anciens_negatifs.sh index 6c3f35a..e7c6ab1 100755 --- a/bde/anciens_negatifs.sh +++ b/bde/anciens_negatifs.sh @@ -13,18 +13,17 @@ result_regex='^\s*-?\d*\.\d*\s*$' if [[ "$1" = "--no-club" ]] then echo "Ne prendra pas en compte les clubs." - cond=" AND NOT club" + cond=" AND NOT type = 'club'" fi if [[ "$1" = "--club" ]] then echo "Ne prendra en compte que les clubs." - cond=" AND club" + cond=" AND type = 'club'" fi -for i in 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 +for i in 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 do echo "En $i :" - # Bon, le grep est pourri, mais la version de bde de egrep fait de la merde - psql bde -c "SELECT sum(solde) FROM adherents adh,inscriptions ins WHERE adh.numcbde=ins.adherent AND annee=$i AND solde<0${cond};" | grep \\. - psql bde -c "SELECT sum(solde) FROM adherents adh,inscriptions ins WHERE adh.numcbde=ins.adherent AND annee=$i AND solde>0${cond};" | grep \\. + psql note -c "SELECT sum(solde) FROM comptes c, adhesions a WHERE c.idbde = a.idbde AND a.annee = $i AND solde < 0${cond};" | grep -v ligne | grep -E '[0-9]' + psql note -c "SELECT sum(solde) FROM comptes c, adhesions a WHERE c.idbde = a.idbde AND a.annee = $i AND solde > 0${cond};" | grep -v ligne | grep -E '[0-9]' done -- 2.39.2