# HG changeset patch # User Bernhard Reiter # Date 1580377640 -3600 # Node ID 91aaf455c44ea3e0134ba8dd45f51c19dcb6d67e # Parent b8d0cc8d7221b17069c59d15a1b630d924767147 Add new template zeiterfassung-hierarchy1 * Add template for getan-report for the use case where hierarchical project keys are used to select the workpackages within a project. The grouping within the new template is done the way it is, because a second attribute lookup is not possible in Jinja2, when having just an entry it is not possible to get the `projects[entry.project_id].key`. diff -r b8d0cc8d7221 -r 91aaf455c44e CHANGES --- a/CHANGES Thu Jan 30 10:42:34 2020 +0100 +++ b/CHANGES Thu Jan 30 10:47:20 2020 +0100 @@ -1,5 +1,9 @@ (unreleased) + * Add new templates/zeiterfassung-hierarchy1 for creating zeiterfassung.txt + output where users have used the project keys to record workpackages within + a zeiterfassung.txt file. It allows a use case where hierarchical project + keys are used. (Bernhard Reiter) * scripts/getan-daily-report: improve summary output by printing the day first. (Bernhard Reiter) diff -r b8d0cc8d7221 -r 91aaf455c44e getan/templates/zeiterfassung-hierarchy1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/getan/templates/zeiterfassung-hierarchy1 Thu Jan 30 10:47:20 2020 +0100 @@ -0,0 +1,23 @@ +{#- using projects keys as zeiterfassungs workpackages +-#} +{%- for day, day_entries + in entries|sort(attribute='startisoday')|groupby('startisoday') -%} + {%- for project in projects -%} + {%- for project_id, project_day_entries + in day_entries|sort(attribute='project_id')|groupby('project_id') %} + + {%- if project_id == project.id -%} +{{ day }} {{ (project_day_entries|duration|human_time).rjust(5) + }}h a {{ user.ljust(3) }} [{{ project.key }}] + {%- for entry in project_day_entries -%} + {%- if loop.index == 1 -%}{{ ' ' }} + {%- else -%}{{ ';\n ' }} + {%- endif -%} + {{ entry.get_comment() }} + {%- endfor %}{{'\n'}} + {%- endif -%} + {%- endfor -%} + {%- endfor -%} +# d total: {{ (day_entries|duration|human_time).rjust(5) }}h + +{% endfor -%}