Mercurial > getan
changeset 32:4de86feae6ac
Added a parameter 'year' to the 'wochenbericht' script that filters out the week of a specific year only.
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 31 Aug 2010 19:27:36 +0200 (2010-08-31) |
parents | fa5b3b1db867 |
children | f96a18c10836 |
files | ChangeLog contrib/wochenbericht |
diffstat | 2 files changed, 18 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Aug 31 19:25:23 2010 +0200 +++ b/ChangeLog Tue Aug 31 19:27:36 2010 +0200 @@ -1,3 +1,8 @@ +2010-08-31 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * contrib/wochenbericht: Added a parameter 'year' that makes possible to + filter out the week of a specific year only. + 2010-08-31 Ingo Weinzierl <ingo.weinzierl@intevation.de> ISSUE1566
--- a/contrib/wochenbericht Tue Aug 31 19:25:23 2010 +0200 +++ b/contrib/wochenbericht Tue Aug 31 19:27:36 2010 +0200 @@ -14,8 +14,9 @@ # usage() { cat <<EOF -usage: ./wochenbericht [<week of year>] [<getan database file>] +usage: ./wochenbericht [<week of year>] [<year>] [<getan database file>] <week of year> defaults to current week + <year> defaults to current year <getan database file> defaults to time.db EOF exit 1 @@ -34,7 +35,13 @@ WEEK=$1 fi -TIME_DB=${2:-time.db} +if [[ "$2" -eq "" ]]; then + YEAR=`date +'%Y'` +else + YEAR=$2 +fi + +TIME_DB=${3:-time.db} if [ ! -f ${TIME_DB} ]; then echo "error: Database file ${TIME_DB} does not exist." @@ -48,8 +55,10 @@ project_id, sum(strftime('%s', stop_time) - strftime('%s', start_time)) AS total FROM entries - WHERE strftime('%W', start_time) = '${WEEK}' OR - strftime('%W', stop_time) = '${WEEK}' + WHERE (strftime('%W', start_time) = '${WEEK}' AND + strftime('%Y', start_time) = '${YEAR}') OR + (strftime('%W', stop_time) = '${WEEK}' AND + strftime('%Y', stop_time) = '${YEAR}') GROUP BY project_id ) ON id = project_id WHERE active;