Time Entries Report

Since Reporter plugin version 1.0.2, the feature Time Entries Report was added. Let's take a look how it works.

Feature description

Firstly, you need to go to administration - plugins - Reporter plugin. Here, when you create a new report, please make sure to select the time entries type.

type_time_entries.png

Then, as the name of the report suggests, you have to go to a Spent time section either in a specific project or at the global level (spent time from all projects' issues). In the below screenshot, the example is the global spent time section.

spent_time_report.png

Note: Please note that in the Spent time section will appear only reports that are type "time entries" accordingly.

only_time_entries.png

Example

Let's take a look at the following example code. It will print the following Spent time attributes:
  • ID
  • Hours
  • Comments
  • Spent on
  • Issue's Subject

Note: The available methods (attributes) for the time-entry object could be found on Reporter syntax page documentation article.

Code used:

<table border="1px solid black">
{% for time_entry in time_entries%}
 <tr>
 <td><b>ID</b>: <br>{{time_entry.id}}</br></td>
 <td><b>Hours</b>: <br>{{time_entry.hours}}</br></td>
 <td><b>Comments</b>: <br>{{time_entry.comments}}</br></td>
 <td><b>Spent on</b>: <br>{{time_entry.spent_on}}</br></td>
 <td><b>Issue Subject</b>: <br>{{time_entry.issue.subject}}</br></td>
 </tr>
{% endfor %}
</table>

And the result is as follows.

Report_pdf.png

Note: As an alternative to the described feature above, you are able to use Issues List report (or Issue if work was carried out in one issue) and use issue.time_entries to get the needed results.

Sorting feature

You could use the following line of code for sorting:

time_entries | sort "<time entry attribute>" 

Please check the example code below:

{% assign timetotal = 9 %}
{% assign timexes = time_entries.all | sort: "hours" %}
<table border="1px solid black">
{% for time_entry in timexes %}
  <tr>
    <td>ID {{time_entry.id}}</td>
    <td>Username {{time_entry.user.name}}</td>
    <td>Spent on {{time_entry.spent_on | date : "%d.%m.%y"}}</td>
    <td>Hours {{time_entry.hours}} </td>
  </tr>
{% endfor %}
</table>
<b>Timetotal value:</b> {{ timetotal }}

As a result, the following table will be printed via the Reporter plugin: sorting_table.png

Was this article helpful? Yes  No
11 from 25 found this helpful