Mercurial > getan
comparison scripts/getan-daily-report @ 533:a4044956e08c
scripts/getan-daily-report: improve summary output
* .. by printing the day first, using an YYYYMMDD and localized weekday
abbreviation because this is BER's default format.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Mon, 06 Jan 2020 11:05:43 +0100 |
parents | 11d97a40dfa5 |
children |
comparison
equal
deleted
inserted
replaced
532:fa1eb72e2764 | 533:a4044956e08c |
---|---|
19 # TODO: | 19 # TODO: |
20 # * use python v>=3.2 variants in the code where noted. | 20 # * use python v>=3.2 variants in the code where noted. |
21 | 21 |
22 import argparse | 22 import argparse |
23 import datetime | 23 import datetime |
24 import locale | |
24 import logging | 25 import logging |
25 import sqlite3 | 26 import sqlite3 |
26 | 27 |
27 factor = {'privat': 0} | 28 factor = {'privat': 0} |
29 | |
30 # sets the locale for all categories to the user’s default setting | |
31 #(typically specified in the LANG environment variable). | |
32 locale.setlocale(locale.LC_ALL, '') | |
28 | 33 |
29 l = logging | 34 l = logging |
30 l.basicConfig(level=logging.INFO, | 35 l.basicConfig(level=logging.INFO, |
31 # l.basicConfig(level=logging.DEBUG, | 36 # l.basicConfig(level=logging.DEBUG, |
32 format='%(message)s') | 37 format='%(message)s') |
163 else: | 168 else: |
164 l.info("ignoring factor {}".factor[desc]) | 169 l.info("ignoring factor {}".factor[desc]) |
165 total_time += length | 170 total_time += length |
166 task_total[e[1]] += length | 171 task_total[e[1]] += length |
167 | 172 |
173 print(report_range_start.strftime("%Y%m%d %a"), end=" ") | |
168 print("(" + hhhmm_from_timedelta(total_time).strip() + ")") | 174 print("(" + hhhmm_from_timedelta(total_time).strip() + ")") |
169 for t in tasks: | 175 for t in tasks: |
170 if task_total[t] != datetime.timedelta(0): | 176 if task_total[t] != datetime.timedelta(0): |
171 print("\t" + tasks[t], hhhmm_from_timedelta(task_total[t])) | 177 print("\t" + tasks[t], hhhmm_from_timedelta(task_total[t])) |
172 | 178 |