Mercurial > getan > getan
view getan/templates/zeiterfassung2 @ 536:a59622c06936
Fix generating reports if no week given
unix_week() cannot handle week being None but does so for year. It just
assumes the current year in this case, although this only duplicates the
initialisation of year with c_year in this context. week being None gives
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
load_entries() handles the case with no week given, thus call it anyhow.
This fix makes it possible to invoke scripts/getan-report with a year given
but no week and seeing the expected result (data for a whole year) instead
of a traceback.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 09 Jan 2020 11:32:34 +0100 |
parents | a499441249af |
children | 5ee84c9805f9 |
line wrap: on
line source
{% for proj in projects %} {%- if proj.entries %} ## category: {{ proj.key }} ({{ proj.desc }}) {% for grouper, gentries in proj.entries|sort(attribute='startisoday')|groupby('startisoday') %} {#- grouper will contain the attribute used for groupby() -#} {% for ggrouper, ggentries in gentries|groupby('workpackage') %} {{ gentries[0].start|date_format }} {{ (ggentries|duration|human_time).rjust(5) }}h a {{ user.ljust(3) }} [{{ ggrouper }}] {%- for entry in ggentries -%} {%- if loop.index == 1 -%}{{ ' ' }} {%- else -%}{{ ';\n ' }} {%- endif -%} {{ entry.get_comment() }} {%- endfor -%} {%- endfor %} # daily sum: {{ gentries|duration|human_time }}h {% endfor -%} ## total category {{ proj.key }}: {{ proj.get_total_duration()|human_time }}h {% endif -%} {% endfor %} ### total all categories: {{ total_time|human_time }}h