changeset 486:d80f40d239d2

renamed scripts. getan-report and getan-day-report now installed as a script. old script moved to done/contrib
author Magnus Schieder <mschieder@intevation.de>
date Fri, 29 Jun 2018 18:38:55 +0200
parents 726206815059
children e7334b946caa
files contrib/wochenbericht contrib/zeitsort.py scripts/getan-day-report scripts/getan-report scripts/getan-report.py scripts/getaneval.py scripts/wochenbericht scripts/zeitsort.py setup.py
diffstat 9 files changed, 376 insertions(+), 377 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/wochenbericht	Fri Jun 29 18:38:55 2018 +0200
@@ -0,0 +1,77 @@
+#!/bin/bash
+#
+# wochenbericht
+# -------------
+# (c) 2008 by Sascha L. Teichmann
+
+# Little script to summarize times within a given week.
+# usage:
+# ./wochenbericht [<week of year>] [<getan database file>]
+# week defaults to current week, database to time.db
+#
+# This is Free Software in terms of GPLv3 or later. See
+# LICENSE coming with getan for details.
+#
+usage() {
+    cat <<EOF
+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
+}
+
+if [ "$1" ==  "--help" -o "$1" == "-h" ]; then
+    usage
+fi
+
+
+if [[ "$1" -eq "" ]]; then
+    WEEK=`date +'%W'`
+    # remove hash below if you want previous week
+    #WEEK=`expr ${WEEK} '-' 1 '|' 52`
+else
+    WEEK=$1
+fi
+
+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."
+    usage
+fi
+
+sqlite3 ${TIME_DB} "
+SELECT coalesce(description, 'Verschiedenes'), total FROM projects 
+INNER JOIN (
+    SELECT 
+        project_id,
+        sum(strftime('%s', stop_time) - strftime('%s', start_time)) AS total
+    FROM entries
+    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;
+" | awk '
+function human_time(t) {
+    h = int(t / 3600)
+    m = int((t % 3600)/60.0 + 0.5)
+    while (m >= 60) { ++h; m -= 60 }
+    return sprintf("%2d:%02dh", h, m)
+}
+BEGIN { FS="|"; sum = 0 }
+      { sum += $2 
+        printf("%s: %s\n", human_time($2), $1) 
+      }
+END   { printf("%s: Gesamt\n", human_time(sum)) } 
+'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/zeitsort.py	Fri Jun 29 18:38:55 2018 +0200
@@ -0,0 +1,49 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# zeitsort
+# --------
+# (c) 2008 by Sascha L. Teichmann <sascha.teichmann@intevation.de>
+#
+# Simple script which sorts lines of zeiterfassung.txt files by date.
+#
+# This is Free Software licensed under the terms of GPLv3 or later.
+# For details see LICENSE coming with the source of 'getan'.
+#
+
+import sys
+import re
+
+from datetime import date
+
+DATE = re.compile("(\d\d)\.(\d\d)\.(\d\d\d\d)")
+
+def date_cmp(a, b):
+    ma = DATE.search(a)
+    mb = DATE.search(b)
+    if not ma and not mb: return cmp(a, b)
+    if ma and not mb: return -1
+    if not ma and mb: return +1
+    da = date(int(ma.group(3)), int(ma.group(2)), int(ma.group(1)))
+    db = date(int(mb.group(3)), int(mb.group(2)), int(mb.group(1)))
+    return cmp(da, db)
+
+def main():
+    all = []
+    while True:
+        line = sys.stdin.readline()
+        if not line: break
+        if not DATE.search(line):
+            # handle multi lines
+            if not all: all.append(line)
+            else:       all[-1] += line
+        else:
+            all.append(line)
+    all.sort(date_cmp)
+    sys.stdout.write(''.join(all))
+    sys.stdout.flush()
+
+if __name__ == '__main__':
+    main()
+
+# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/getan-day-report	Fri Jun 29 18:38:55 2018 +0200
@@ -0,0 +1,176 @@
+#!/usr/bin/env python3
+"""
+write a daily report accessing a database from
+http://hg.intevation.de/getan 1.1dev3.
+"""
+# hastily done, written to learn the getan database format and its manipulation
+# Free Software under GNU GPL v>=3
+# 20130109 bernhard@intevation.de
+# 20140103 bernhard@intevation.de:
+#   started from 2013/getan-writeout-timesorted.py
+#   ported to python3. Removed the dependency for functions from worklog.py.
+#   the timesorted variant can be uncommented in the code for now
+# 20140109 bernhard@intevation.de:
+#   Total time output format improved.
+# 20140120 bernhard@intevation.de:
+#   added command line options, requires argparse module now (e.g. Python>=3.2)
+# 20141104 bernhard@intevation.de:
+#   migration to argparse complete, added -t option
+# TODO:
+#  * use python v>=3.2 variants in the code where noted.
+
+import argparse
+import datetime
+import logging
+import sqlite3
+
+factor = {'privat': 0}
+
+l = logging
+l.basicConfig(level=logging.INFO,
+              # l.basicConfig(level=logging.DEBUG,
+              format='%(message)s')
+#                    format='%(asctime)s %(levelname)s %(message)s')
+
+
+def hhhmm_from_timedelta(td):
+    """Return a string '-HHH:MM' from the timedelta parameter.
+
+    Accounts for way the integer division works for negative numbers:
+        -2 // 60 == -1
+        -2 % 60 == 58
+    by first working on the positive number and then adding the minus
+    to the string.
+
+    For python >=3.1. Successor of hhmm_from_timedelta() from
+    http://intevation.de/cgi-bin/viewcvs-misc.cgi/worklog.py/ .
+    """
+    total_minutes = abs(round(td.days * 24 * 60 + td.seconds / 60))
+    # variant for Python v>3.2:
+    # total_minutes = abs(round(td/datetime.timedelta(minutes=1)))
+
+    hours = total_minutes // 60
+    minutes = total_minutes % 60
+
+    h_string = "{}".format(hours)
+
+    if(td.days < 0):
+        h_string = "-" + h_string
+
+    return "{:>3s}:{:02d}".format(h_string, minutes)
+
+
+def self_test():
+    """Run some simple tests on hhhmm_from_timedelta().
+
+    e.g. run like
+        python3 -c 'from getan_report_20140103 import *; self_test()'
+    """
+    l.info(hhhmm_from_timedelta(datetime.timedelta(minutes=1)))
+    l.info(hhhmm_from_timedelta(datetime.timedelta(minutes=-2)))
+
+
+def main():
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument("-t", action='store_true',
+                        help="timesorted output and default reportday to today")
+    parser.add_argument("dbfilename")
+    parser.add_argument("reportday", nargs='?',
+                        help="day to report  yyyy-mm-dd")
+
+    args = parser.parse_args()
+    l.debug(args)
+
+    if args.reportday:
+        try:
+            report_range_start = \
+                datetime.datetime.strptime(args.reportday, "%Y-%m-%d")
+        except ValueError:
+            report_range_start = \
+                datetime.datetime.strptime(args.reportday, "%Y%m%d")
+
+    elif args.t:
+        # start with today 00:00
+        report_range_start = datetime.datetime.combine(
+            datetime.date.today(), datetime.time())
+    else:
+        # start with yesterday 00:00
+        report_range_start = datetime.datetime.combine(
+            datetime.date.today() - datetime.timedelta(days=1),
+            datetime.time())
+    report_range_end = report_range_start + datetime.timedelta(days=1)
+
+    l.info("Opening sqlite3 database '%s'" % args.dbfilename)
+    conn = sqlite3.connect(
+        args.dbfilename,
+        detect_types=sqlite3.PARSE_DECLTYPES | sqlite3.PARSE_COLNAMES)
+    c = conn.cursor()
+
+    tasks = {}
+    task_total = {}
+
+    c.execute('select * from projects')
+    for t in c:
+        l.debug(t)
+        tasks[t[0]] = t[2]
+        task_total[t[0]] = datetime.timedelta()
+
+# from getan 1.0 20130103
+# CREATE TABLE entries (
+#    id          INTEGER PRIMARY KEY AUTOINCREMENT,
+#    project_id  INTEGER REFERENCES projects(id),
+#    start_time  TIMESTAMP NOT NULL,
+#    stop_time   TIMESTAMP NOT NULL,
+#    description VARCHAR(256),
+#
+#    CHECK (strftime('%s', start_time) <= strftime('%s', stop_time))
+# );
+
+    total_time = datetime.timedelta()
+
+    if args.t:
+        c.execute('select * from entries order by start_time')
+    else:
+        c.execute('select * from entries order by project_id')
+    for e in c:
+        l.debug(e)
+        # let us ignore microseconds
+        start_time = e[2].replace(microsecond = 0)
+        stop_time = e[3].replace(microsecond = 0)
+        length = stop_time - start_time
+
+        desc = tasks[e[1]]
+
+        if start_time >= report_range_start and start_time < report_range_end:
+            if args.t:
+                print("{0:%Y-%m-%d %H:%M}-\n"
+                      "{1:%Y-%m-%d %H:%M} {4}  {2}: {3}\n".
+                      format(start_time, stop_time, desc, e[4],
+                             hhhmm_from_timedelta(length)))
+            else:
+                print("{0} {2}: {3} {4}".
+                      format(start_time, stop_time, desc, e[4],
+                             hhhmm_from_timedelta(length)))
+            if desc in factor:
+                # python3.1 does not allow timedelta division.
+                # TODO: Make python3.1 save or update to python3.2.
+                # l.info("applying factor %f to entry %s" % (factor[desc], e))
+                # length = (length * int(factor[desc]*1000))/1000
+                # Until python3.2 we only honor a factor of zero:
+                if factor[desc] == 0:
+                    length = datetime.timedelta(0)
+                    l.info("not counting {}".format(e))
+                else:
+                    l.info("ignoring factor {}".factor[desc])
+            total_time += length
+            task_total[e[1]] += length
+
+    print("(" + hhhmm_from_timedelta(total_time).strip() + ")")
+    for t in tasks:
+        if task_total[t] != datetime.timedelta(0):
+            print("\t" + tasks[t], hhhmm_from_timedelta(task_total[t]))
+
+    c.close()
+
+if __name__ == "__main__":
+    main()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/getan-report	Fri Jun 29 18:38:55 2018 +0200
@@ -0,0 +1,70 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# (c) 2013, 2014 by Björn Ricks <bjoern.ricks@intevation.de>
+#
+# This is Free Software licensed under the terms of GPLv3 or later.
+# For details see LICENSE coming with the source of 'getan'.
+
+import codecs
+import locale
+import sys
+
+from datetime import date, datetime, timedelta
+import argparse
+
+from getan.template import render
+
+
+def main():
+    usage='getan-get-evaluation [options]'
+    parser = argparse.ArgumentParser(prog='getan', usage=usage)
+
+    parser.add_argument('-d', '--database', dest='database',metavar="DATABASE",
+                        help='metavar="DATABASE')
+    parser.add_argument('-t', '--template', dest='template',
+                        metavar='TEMPLATE', help='name of getan template')
+    parser.add_argument('-u', '--user', dest='user', help='name of user')
+    parser.add_argument('-p', '--project', dest='project',
+                        help='key of output project')
+    parser.add_argument('-w', '--week', type=int, dest='week',
+                        help='week of year')
+    parser.add_argument('-y', '--year', type=int, dest='year', help='year')
+    parser.add_argument('-c', '--lastweek', dest='lastweek',
+                        help='entries of last working week',
+                        action='store_true')
+    parser.add_argument('-m', '--empty', dest='empty',
+                        help='show projects without an entries',
+                        action="store_true")
+    parser.add_argument('--encoding', dest='encoding',
+                        help='encoding of output', metavar='ENCODING')
+
+    args = parser.parse_args()
+
+    if args.lastweek:
+        week = (datetime.now() - timedelta(7)).isocalendar()[1]
+        year = int(date.today().strftime("%Y"))
+    else:
+        year = args.year
+        week = args.week
+
+    template_name = args.template or "wochenbericht"
+
+    if not args.encoding:
+        encoding = locale.getdefaultlocale()[1] or "utf-8"
+
+    sys.stdout = codecs.getwriter(encoding)(sys.stdout.detach())
+
+    user = None
+    if args.user:
+        user = args.user
+
+    print(render(database=args.database, user=user,
+                 template=template_name, year=year, week=week,
+                 project=args.project, empty_projects=args.empty))
+
+
+if __name__ == '__main__':
+    main()
+
+# vim:set ts=4 sw=4 si et sta sts=4 :
--- a/scripts/getan-report.py	Thu Jun 28 16:27:09 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-#!/usr/bin/env python3
-"""
-write a daily report accessing a database from
-http://hg.intevation.de/getan 1.1dev3.
-"""
-# hastily done, written to learn the getan database format and its manipulation
-# Free Software under GNU GPL v>=3
-# 20130109 bernhard@intevation.de
-# 20140103 bernhard@intevation.de:
-#   started from 2013/getan-writeout-timesorted.py
-#   ported to python3. Removed the dependency for functions from worklog.py.
-#   the timesorted variant can be uncommented in the code for now
-# 20140109 bernhard@intevation.de:
-#   Total time output format improved.
-# 20140120 bernhard@intevation.de:
-#   added command line options, requires argparse module now (e.g. Python>=3.2)
-# 20141104 bernhard@intevation.de:
-#   migration to argparse complete, added -t option
-# TODO:
-#  * use python v>=3.2 variants in the code where noted.
-
-import argparse
-import datetime
-import logging
-import sqlite3
-
-factor = {'privat': 0}
-
-l = logging
-l.basicConfig(level=logging.INFO,
-              # l.basicConfig(level=logging.DEBUG,
-              format='%(message)s')
-#                    format='%(asctime)s %(levelname)s %(message)s')
-
-
-def hhhmm_from_timedelta(td):
-    """Return a string '-HHH:MM' from the timedelta parameter.
-
-    Accounts for way the integer division works for negative numbers:
-        -2 // 60 == -1
-        -2 % 60 == 58
-    by first working on the positive number and then adding the minus
-    to the string.
-
-    For python >=3.1. Successor of hhmm_from_timedelta() from
-    http://intevation.de/cgi-bin/viewcvs-misc.cgi/worklog.py/ .
-    """
-    total_minutes = abs(round(td.days * 24 * 60 + td.seconds / 60))
-    # variant for Python v>3.2:
-    # total_minutes = abs(round(td/datetime.timedelta(minutes=1)))
-
-    hours = total_minutes // 60
-    minutes = total_minutes % 60
-
-    h_string = "{}".format(hours)
-
-    if(td.days < 0):
-        h_string = "-" + h_string
-
-    return "{:>3s}:{:02d}".format(h_string, minutes)
-
-
-def self_test():
-    """Run some simple tests on hhhmm_from_timedelta().
-
-    e.g. run like
-        python3 -c 'from getan_report_20140103 import *; self_test()'
-    """
-    l.info(hhhmm_from_timedelta(datetime.timedelta(minutes=1)))
-    l.info(hhhmm_from_timedelta(datetime.timedelta(minutes=-2)))
-
-
-def main():
-    parser = argparse.ArgumentParser(description=__doc__)
-    parser.add_argument("-t", action='store_true',
-                        help="timesorted output and default reportday to today")
-    parser.add_argument("dbfilename")
-    parser.add_argument("reportday", nargs='?',
-                        help="day to report  yyyy-mm-dd")
-
-    args = parser.parse_args()
-    l.debug(args)
-
-    if args.reportday:
-        try:
-            report_range_start = \
-                datetime.datetime.strptime(args.reportday, "%Y-%m-%d")
-        except ValueError:
-            report_range_start = \
-                datetime.datetime.strptime(args.reportday, "%Y%m%d")
-
-    elif args.t:
-        # start with today 00:00
-        report_range_start = datetime.datetime.combine(
-            datetime.date.today(), datetime.time())
-    else:
-        # start with yesterday 00:00
-        report_range_start = datetime.datetime.combine(
-            datetime.date.today() - datetime.timedelta(days=1),
-            datetime.time())
-    report_range_end = report_range_start + datetime.timedelta(days=1)
-
-    l.info("Opening sqlite3 database '%s'" % args.dbfilename)
-    conn = sqlite3.connect(
-        args.dbfilename,
-        detect_types=sqlite3.PARSE_DECLTYPES | sqlite3.PARSE_COLNAMES)
-    c = conn.cursor()
-
-    tasks = {}
-    task_total = {}
-
-    c.execute('select * from projects')
-    for t in c:
-        l.debug(t)
-        tasks[t[0]] = t[2]
-        task_total[t[0]] = datetime.timedelta()
-
-# from getan 1.0 20130103
-# CREATE TABLE entries (
-#    id          INTEGER PRIMARY KEY AUTOINCREMENT,
-#    project_id  INTEGER REFERENCES projects(id),
-#    start_time  TIMESTAMP NOT NULL,
-#    stop_time   TIMESTAMP NOT NULL,
-#    description VARCHAR(256),
-#
-#    CHECK (strftime('%s', start_time) <= strftime('%s', stop_time))
-# );
-
-    total_time = datetime.timedelta()
-
-    if args.t:
-        c.execute('select * from entries order by start_time')
-    else:
-        c.execute('select * from entries order by project_id')
-    for e in c:
-        l.debug(e)
-        # let us ignore microseconds
-        start_time = e[2].replace(microsecond = 0)
-        stop_time = e[3].replace(microsecond = 0)
-        length = stop_time - start_time
-
-        desc = tasks[e[1]]
-
-        if start_time >= report_range_start and start_time < report_range_end:
-            if args.t:
-                print("{0:%Y-%m-%d %H:%M}-\n"
-                      "{1:%Y-%m-%d %H:%M} {4}  {2}: {3}\n".
-                      format(start_time, stop_time, desc, e[4],
-                             hhhmm_from_timedelta(length)))
-            else:
-                print("{0} {2}: {3} {4}".
-                      format(start_time, stop_time, desc, e[4],
-                             hhhmm_from_timedelta(length)))
-            if desc in factor:
-                # python3.1 does not allow timedelta division.
-                # TODO: Make python3.1 save or update to python3.2.
-                # l.info("applying factor %f to entry %s" % (factor[desc], e))
-                # length = (length * int(factor[desc]*1000))/1000
-                # Until python3.2 we only honor a factor of zero:
-                if factor[desc] == 0:
-                    length = datetime.timedelta(0)
-                    l.info("not counting {}".format(e))
-                else:
-                    l.info("ignoring factor {}".factor[desc])
-            total_time += length
-            task_total[e[1]] += length
-
-    print("(" + hhhmm_from_timedelta(total_time).strip() + ")")
-    for t in tasks:
-        if task_total[t] != datetime.timedelta(0):
-            print("\t" + tasks[t], hhhmm_from_timedelta(task_total[t]))
-
-    c.close()
-
-if __name__ == "__main__":
-    main()
--- a/scripts/getaneval.py	Thu Jun 28 16:27:09 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-#
-# (c) 2013, 2014 by Björn Ricks <bjoern.ricks@intevation.de>
-#
-# This is Free Software licensed under the terms of GPLv3 or later.
-# For details see LICENSE coming with the source of 'getan'.
-
-import codecs
-import locale
-import sys
-
-from datetime import date, datetime, timedelta
-import argparse
-
-from getan.template import render
-
-
-def main():
-    usage='getan-eval.py [options]'
-    parser = argparse.ArgumentParser(prog='getan', usage=usage)
-
-    parser.add_argument('-d', '--database', dest='database',metavar="DATABASE",
-                        help='metavar="DATABASE')
-    parser.add_argument('-t', '--template', dest='template',
-                        metavar='TEMPLATE', help='name of getan template')
-    parser.add_argument('-u', '--user', dest='user', help='name of user')
-    parser.add_argument('-p', '--project', dest='project',
-                        help='key of output project')
-    parser.add_argument('-w', '--week', type=int, dest='week',
-                        help='week of year')
-    parser.add_argument('-y', '--year', type=int, dest='year', help='year')
-    parser.add_argument('-c', '--lastweek', dest='lastweek',
-                        help='entries of last working week',
-                        action='store_true')
-    parser.add_argument('-m', '--empty', dest='empty',
-                        help='show projects without an entries',
-                        action="store_true")
-    parser.add_argument('--encoding', dest='encoding',
-                        help='encoding of output', metavar='ENCODING')
-
-    args = parser.parse_args()
-
-    if args.lastweek:
-        week = (datetime.now() - timedelta(7)).isocalendar()[1]
-        year = int(date.today().strftime("%Y"))
-    else:
-        year = args.year
-        week = args.week
-
-    template_name = args.template or "wochenbericht"
-
-    if not args.encoding:
-        encoding = locale.getdefaultlocale()[1] or "utf-8"
-
-    sys.stdout = codecs.getwriter(encoding)(sys.stdout.detach())
-
-    user = None
-    if args.user:
-        user = args.user
-
-    print(render(database=args.database, user=user,
-                 template=template_name, year=year, week=week,
-                 project=args.project, empty_projects=args.empty))
-
-
-if __name__ == '__main__':
-    main()
-
-# vim:set ts=4 sw=4 si et sta sts=4 :
--- a/scripts/wochenbericht	Thu Jun 28 16:27:09 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-#!/bin/bash
-#
-# wochenbericht
-# -------------
-# (c) 2008 by Sascha L. Teichmann
-
-# Little script to summarize times within a given week.
-# usage:
-# ./wochenbericht [<week of year>] [<getan database file>]
-# week defaults to current week, database to time.db
-#
-# This is Free Software in terms of GPLv3 or later. See
-# LICENSE coming with getan for details.
-#
-usage() {
-    cat <<EOF
-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
-}
-
-if [ "$1" ==  "--help" -o "$1" == "-h" ]; then
-    usage
-fi
-
-
-if [[ "$1" -eq "" ]]; then
-    WEEK=`date +'%W'`
-    # remove hash below if you want previous week
-    #WEEK=`expr ${WEEK} '-' 1 '|' 52`
-else
-    WEEK=$1
-fi
-
-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."
-    usage
-fi
-
-sqlite3 ${TIME_DB} "
-SELECT coalesce(description, 'Verschiedenes'), total FROM projects 
-INNER JOIN (
-    SELECT 
-        project_id,
-        sum(strftime('%s', stop_time) - strftime('%s', start_time)) AS total
-    FROM entries
-    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;
-" | awk '
-function human_time(t) {
-    h = int(t / 3600)
-    m = int((t % 3600)/60.0 + 0.5)
-    while (m >= 60) { ++h; m -= 60 }
-    return sprintf("%2d:%02dh", h, m)
-}
-BEGIN { FS="|"; sum = 0 }
-      { sum += $2 
-        printf("%s: %s\n", human_time($2), $1) 
-      }
-END   { printf("%s: Gesamt\n", human_time(sum)) } 
-'
--- a/scripts/zeitsort.py	Thu Jun 28 16:27:09 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-#
-# zeitsort
-# --------
-# (c) 2008 by Sascha L. Teichmann <sascha.teichmann@intevation.de>
-#
-# Simple script which sorts lines of zeiterfassung.txt files by date.
-#
-# This is Free Software licensed under the terms of GPLv3 or later.
-# For details see LICENSE coming with the source of 'getan'.
-#
-
-import sys
-import re
-
-from datetime import date
-
-DATE = re.compile("(\d\d)\.(\d\d)\.(\d\d\d\d)")
-
-def date_cmp(a, b):
-    ma = DATE.search(a)
-    mb = DATE.search(b)
-    if not ma and not mb: return cmp(a, b)
-    if ma and not mb: return -1
-    if not ma and mb: return +1
-    da = date(int(ma.group(3)), int(ma.group(2)), int(ma.group(1)))
-    db = date(int(mb.group(3)), int(mb.group(2)), int(mb.group(1)))
-    return cmp(da, db)
-
-def main():
-    all = []
-    while True:
-        line = sys.stdin.readline()
-        if not line: break
-        if not DATE.search(line):
-            # handle multi lines
-            if not all: all.append(line)
-            else:       all[-1] += line
-        else:
-            all.append(line)
-    all.sort(date_cmp)
-    sys.stdout.write(''.join(all))
-    sys.stdout.flush()
-
-if __name__ == '__main__':
-    main()
-
-# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- a/setup.py	Thu Jun 28 16:27:09 2018 +0200
+++ b/setup.py	Fri Jun 29 18:38:55 2018 +0200
@@ -50,12 +50,11 @@
           'urwid>=1.1.2'
       ],
       scripts=glob.glob(os.path.join(scripts_dir, "*.py")) +
-      [os.path.join(scripts_dir, "wochenbericht"),
-       os.path.join(scripts_dir, "convert-projects")],
+      [os.path.join(scripts_dir, "getan-report"),
+       os.path.join(scripts_dir, "convert-projects"),
+       os.path.join(scripts_dir, "getan-day-report")],
       entry_points={"console_scripts":
-                    ["getan=getan.main:main",
-                     "getaneval=scripts.getaneval:main",
-                     ]},
+                    ["getan=getan.main:main"]},
       classifiers=[
           "Development Status :: 5 - Production/Stable",
           "Topic :: Utilities",
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)