Jira Timesheet Plugin - Group AND Project Combined Filter

Nov 09, 2011
Carlos Araujo

UPDATE:
We have contacted Andriy Zhdanov and we are currently collaborating to his project. Our code has been submitted to the Jira Timesheet Plugin repository.


This Jira Plugin was developed by Andriy Zhdanov and it is part of an OpenSource Initiative.  Since Jira has a lack of resource time tracking, Zhdanov developed a series of reports that he turned into an easy-to-use plugin.   Oshyn found this plugin somewhat deficient in a few key areas for our Agile Project Management so we slightly modified it to suit our needs.

This Jira Plugin was developed by Andriy Zhdanov and it is part of an OpenSource Initiative. Click here to go to his wiki.

Since Jira has a lack of resource time tracking, Zhdanov developed a series of reports that he turned into an easy-to-use plugin.

Here is a simple example of the time sheet report that needed to be modified to meet our needs:

 



This image shows the time sheet report that this plugin offers. As you can see, there is a range of days and each day has a total number of hours the user worked. Also, this grid is filtered by a Jira group.

This is a very cool and useful grid for developers tracking their work and for Project Managers (PMs) and other management to track their team’s effort.

After a few weeks of using this plugin, Oshyn found out that there is a need to incorporate a little tweak into this time sheet report. The problem Oshyn’s PM team found is that this grid shows the list of users that belong to the filtered group, and the hours they worked, BUT those hours are any hours that the user logged in for any project. So if a user works only partially on a project and the other time in another project, the grid will show the sum of work logged for both projects. This became frustrating to PMs since they needed to drill down into the grid to get to the portion of hours they wanted to see for each user.

Here is what I did to add a project key into this time sheet report and get a grid that shows the users filtered by group/project and the hours worked for each:

Note: Since it is an OpenSource project, the source code is available at the developer’s wiki page.

After downloading the 2.1 version, since Oshyn’sJira is the 4.3 version, I started to identify the classes and the properties file to understand how it works.

As you know the plugins are JAVA code and they use velocity templating.

1.       First, I modified the group-timesheet-gadget.xml file.
  1. Add a user preference tag. Since I don’t want to make this tweak a required filed, I set the required as false.



2.       Next, add the key for the name in the ALL_ALL.xml file.
 

 
3.  In the AJAX call, add the new parameter name and value.



4.       Now it’s time to edit the Java class. The class that handles this Ajax calls for the Jira timesheet reportGroupTimeSheetResource.java using the path /group-timesheet.

 

  1. a. Import the Project and ProjectManager classes from Jira packages
  1. b. Create the private references to the objects.

  2. c. Change the signature of the constructor, adding the new parameter to be received, which is the project key.

  3. d. Change the initialization of the constructor parameters.



  4. e. Change the getVelocityParams functions to enable the project key functionality filter and the extraction of hours from Jira DB.




5.     Now the code that generates the data for the report is done. Next, we need to change the presentation layer. In the results page, the report needs to show that the grid is also filtered by project; however, if this filter was not applied, just show the report filtered by the default fields.

  1. a. For this to happen, we need to change the velocity template for the timesheet plugin group-timesheet.vm file.

  1. b. Then, compile the project with maven and add the jar to the Jira plugin repository through the admin panel.

Here are some screenshots on how the plugin works after the modifications.

 

  • The edit form has now the input for the project key.

 

  • Grid displays the project key that was use for filtering.


Post created by Carlos Araujo, Oshyn Inc. employee.