Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation: Math Expression, Round to the Nearest Multiple of 15

Jeffrey Bistrong
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2021

I have the following math expression

 

{{#=}}({{issue.timetracking.timeSpentSeconds}}/60){{/}} Minutes

 

 

The latest request from the business is that they would like these rounded up to the nearest 15 minutes...for billing purposes. 

 

I cannot figure out for the life of me how to do that.

 

 

Any ideas?

3 answers

1 accepted

1 vote
Answer accepted
Paul O
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2021

See: https://support.atlassian.com/jira-software-cloud/docs/smart-values-math-expressions/#Smartvaluesmathexpressions-Ceil

So you could use: 

{{issue.timetracking.timeSpentSeconds.divide(900).ceil}}*15

 

Jeffrey Bistrong
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2021

@Paul O that actually wasn't working when I had 13 min logged, and when I went up to 48 min, it would round down to 45 min.  However, I was able to finally get it to work with 

 

{{#=}}(CEILING({{issue.timetracking.timeSpentSeconds}}/900)*15){{/}}

Like Paul O likes this
Paul O
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2021

Interesting. I took a quick look to understand this a bit more. It seems that the field for time tracking is treated like an integer (rather than a jira custom field number type). When using the 'divide' operation in my example above, it will never return anything but a whole number. So using 'ceil' has no impact at all.  

As you've found, you need to perform a 'math expression' e.g CEILING.  It seems "numerical operations" (per https://support.atlassian.com/jira-software-cloud/docs/smart-values-math-expressions/ ) only apply to custom fields of the number type

Jeffrey Bistrong
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2021

thanks for the explanation 

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2021

Hi @Jeffrey Bistrong 

No, maybe, and yes...  ;^)

  • No: There does not appear to be a way to set the granularity of the built-in time tracking...yet.  You can alter the default units.
  • Maybe: There could be a marketplace addon which does this with other time-tracking features/tools
  • Yes: You could use an automation rule to perform the rounding/truncation and store the result in a custom field.  However you would need to manage and report on that field independently as the built-in time-tracking features could not use it.
  • Yes 2.0: You could write a complex automation rule which would detect logged time, and then use the REST API to make adjustments to account for your rounding.  This seems like a brittle solution and I would advise against it.  Better to buy a marketplace addon tool if you really need this long-term.

Have you investigated if your billing tools can do the rounding for you, outside of Jira?

Best regards,

Bill

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2021

Jeffrey, just to be clear: are you trying to permanently change the stored value of the time tracking or make a temporary adjustment only for the purpose of reporting?

Thanks!

Jeffrey Bistrong
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2021

I might want to change the value of the stored value (eventually), but for now I am just outputting to a different field for the finance team not to have to do their own rounding

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2021

Thanks for confirming that info. 

As you want to change the stored value I suspect your only options are to research other time-tracking tools from the marketplace with that capability, or to update with an adjustment value, either from the REST API or use an automation rule to log more time to round up.  (That second approach of adjustment will definitely inflate the time tracking.)

Jeffrey Bistrong
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2021

thanks

0 votes
Jeffrey Bistrong
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2021

Reading below, I don't have a solution

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events