# HG changeset patch # User Ingo Weinzierl # Date 1283275656 -7200 # Node ID 4de86feae6acdf208ca46902d5a3adc64e5a42d8 # Parent fa5b3b1db8670c402ddedab7a1c69379f1d0e18f Added a parameter 'year' to the 'wochenbericht' script that filters out the week of a specific year only. diff -r fa5b3b1db867 -r 4de86feae6ac ChangeLog --- 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 + + * contrib/wochenbericht: Added a parameter 'year' that makes possible to + filter out the week of a specific year only. + 2010-08-31 Ingo Weinzierl ISSUE1566 diff -r fa5b3b1db867 -r 4de86feae6ac contrib/wochenbericht --- 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 <] [] +usage: ./wochenbericht [] [] [] defaults to current week + defaults to current year 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;