Smart values to create summary don't give expected result

Ruben Uyterlinde March 26, 2024

Hi,

Context: As of 1st of April July 2024 Jira will limit the amount of worklogs per item (Our worklog is above the max of 5000). We have one project which we use purely for time tracking. 

So I'm currently making a automation to create new ticket every half year. In the summary I want the following: "Worktime yyyy-Hh", with yyyy being the year and h being what half of the year.


For the summary of the newly created ticket I have the following formula:

Worktime {{now.format("yyyy")}}-H{{now.format("Q").asNumber.divide(2).ceil}}

Current date is 2024-03-26 

now.format("yyyy") => 2024

now.format("Q") => 1

now.format("Q").asNumber => 1

now.format("Q").asNumber.divide(2) => 0 (expected 0.5)

now.format("Q").asNumber.divide(2).ceil => 0 (expected 1)

 

What formula can I use to achieve this required results? 


Capture.PNG

Thanks in advance! 

Greetings,

Ruben

2 answers

1 accepted

0 votes
Answer accepted
Tugba Capaci
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.
March 26, 2024

Hi @Ruben Uyterlinde ,


What are H0 and H1? Are they representing the halves of the year?

If so, you can use the following:


{{now.format("yyyy")}}-H{{#if(now.monthOfYear.lte(6))}}1{{/}}{{#if(now.monthOfYear.gt(6))}}2{{/}}



If not, could you please clarify? I'd like to assist.

For math expressions you can check out the doc here.

Tugba
actioner.com

Ruben Uyterlinde March 26, 2024

Hi @Tugba Capaci

Thanks, nice way to solve it! Variable h was indeed representing havles of years.

Do you get the same result when using these fomula's, just to verify. I consider them bugs and will report them if you get the same result. 

now.format("Q").asNumber.divide(2) => 0 (expected 0.5)

now.format("Q").asNumber.divide(2).ceil => 0 (expected 1)

Greetings,

Ruben

Tugba Capaci
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.
March 26, 2024

Yes, i am getting the same result. 

divide(2) and divide(2).ceil always return 0. 

Like Ruben Uyterlinde likes this
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.
March 26, 2024

Hi @Ruben Uyterlinde 

It appears the integer typing follows through to the end of the calculation after the earlier use of the format() function. 

Please try using the longer form of the math operations when you want to manage the typing and significant digits:

{{#=}}CEILING ( {{now.format("Q")}} / 2 ){{/}}

Or...

First create a variable with a value of 1.0 and multiply that by the formatted date's quarter before the division.  I believe this will force the typing to continue.

{{varOne.asNumber.multiply(now.format("Q").asNumber).divide(2).ceil}}

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events