view getan/templates/zeiterfassung-hierarchy1 @ 540:91aaf455c44e

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`.
author Bernhard Reiter <bernhard@intevation.de>
date Thu, 30 Jan 2020 10:47:20 +0100
parents
children 413cabeca333
line wrap: on
line source
{#- 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 -%}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)