Skip to content

Commit

Permalink
fix reporting, particularly by category
Browse files Browse the repository at this point in the history
  • Loading branch information
falconindy committed Oct 3, 2010
1 parent 877d6a9 commit 16f7487
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions clockwerk
Expand Up @@ -136,9 +136,8 @@ job_start() {
# verify category exists # verify category exists
# do we want to create the category if it doesn't exist? # do we want to create the category if it doesn't exist?


category_verify "$1" local catnum=$(category_verify "$1")
local catnum=$? [[ $catnum ]] || die "Invalid category: '$1'"
[[ $catnum -eq 0 ]] && die "Invalid category: '$1'"


lock_acquire || return 1 lock_acquire || return 1
local ret=$? local ret=$?
Expand Down Expand Up @@ -218,7 +217,7 @@ category_verify() {
sql="SELECT c_id from category where c_name = '$1';" sql="SELECT c_id from category where c_name = '$1';"
result=$(exec_query "$sql") result=$(exec_query "$sql")


[[ -z $result ]] && return 0 || return $result [[ $result ]] && echo $result || return 1
} }




Expand Down Expand Up @@ -253,11 +252,10 @@ do_category() {
} }


do_report() { do_report() {
local action=$1; shift
local from to cat local from to cat


while getopts "f:t:c:" opt; do while getopts "f:t:c:" opt; do
case "$opt" in case $opt in
f) from=$(date --date="$OPTARG" +%s 2>/dev/null) || die "Invalid from date: '$OPTARG'" ;; f) from=$(date --date="$OPTARG" +%s 2>/dev/null) || die "Invalid from date: '$OPTARG'" ;;
t) to=$(date --date="$OPTARG" +%s 2>/dev/null) || die "Invalid to date: '$OPTARG'" ;; t) to=$(date --date="$OPTARG" +%s 2>/dev/null) || die "Invalid to date: '$OPTARG'" ;;
c) category_verify "$OPTARG" && cat="$OPTARG" || die "Category not found: '$OPTARG'" ;; c) category_verify "$OPTARG" && cat="$OPTARG" || die "Category not found: '$OPTARG'" ;;
Expand Down

0 comments on commit 16f7487

Please sign in to comment.