Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Let me to explain a little bit what this script is doing just in case you want to modify it. It starts with usual ScriptRunner boilerplate like @WithPlugin and @PluginModule to access WorklogPRO services. “issue” is build-in value provided by ScriptRunner and refers to the issue user is viewing. We first try to access “Overtime” attribute definition using AttrTypeService of WorklogPRO. If attribute is not defined we skip all calculations. This is just guard so that we don’t get any error if someone deletes this attribute. If attribute definition is present we check all worklogs of the issue and filter the ones which has “Overtime” attribute set. After that we sum up “time spent” values of worklog. Note that this value is actually number of seconds so we cast it to Long. Since we have chosen “Duration(time-tracking” template at the beginning of field definition this number of seconds value will be properly converted to user readable format, such as “3 hours 30 minutes”.

...

This is our result. I don’t know why Overtime field is displayed under Dates section by ScriptRunner but I’m sure it is something configurable but we will not deal with it for now.

...

This is our final “ScriptRunner Custom Field Configuration”.

...