(8.4.0) Remaining time
Title | Remaining time |
---|---|
Description | It is the remaining result from the total Pack Size minus the Total Time Spent |
Objective | Knowing how much time left is there in your project. |
Audience |
|
What does a Jira Project Represent? | A Jira Project of any type, where time tracking is a valuable asset |
Focus | Project tracking and monitorization |
Configuration
1. Create a Projectrak Duration field called "Pack Size".
2. Create a Projectrak Cumulative field called "Total Time Spent".
3. Insert the following Groovy script and modify according to your instance into "Remaining time" field
Pre-requisites:
- Projectrak Duration field called "Pack Size"
- Projectrak Cumulative field called "Total Time Spent"
Description: It returns the difference between the Pack Size and the Total Time Spent in the current project
Use in: It should be used as a Projectrak Script field
Variables in context:
- project [com.atlassian.jira.project.Project]: The current project
COST_FIELD_ID: Line 12 in the script. In the example we are using 21. Please use the ID that corresponds to your "Cost Size" field
Groovy Script
package deiser.profields.scripts import com.atlassian.jira.component.ComponentAccessor import com.deiser.jira.profields.api.field.FieldService import com.deiser.jira.profields.api.field.cumulative.CumulativeField import com.deiser.jira.profields.api.field.duration.DurationField import com.deiser.jira.profields.api.value.ValueService // Configuration def PACK_SIZE_FIELD_ID = 122 def TOTAL_TIME_SPENT_FIELD_ID = 82 // Components def fieldService = ComponentAccessor.getOSGiComponentInstanceOfType(FieldService.class) def valueService = ComponentAccessor.getOSGiComponentInstanceOfType(ValueService.class) def jiraDurationUtils = ComponentAccessor.jiraDurationUtils // Get the fields def supportPackSizeField = fieldService.get(PACK_SIZE_FIELD_ID) def totalTimeSpentField = fieldService.get(TOTAL_TIME_SPENT_FIELD_ID) // Get the field values in the current project def supportPackSize = valueService.getValue(project, (DurationField) supportPackSizeField) ?: 0 def totalTimeSpent = valueService.getValue(project, (CumulativeField) totalTimeSpentField) ?: 0 // Returns the difference between the budget and the incurred cost return jiraDurationUtils.getShortFormattedDuration(supportPackSize < totalTimeSpent ? 0L : (supportPackSize - totalTimeSpent).longValue())
4. Configure the project's layout including all of the fields created.
5. Associate the Layout to the project you need this information to be applied to.
6. The result should be something like this: (please, keep in mind that this is only an example and your results should vary from what it is shown in the screenshot).