Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Add task Original estimate to Planned start

Filippo Balducci
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 5, 2024

Hi all, 

I tried to create a rule that triggers when a task Original estimate or Planned start are modified, that automatically add the Original estimate (eg 1w 2d 3h) to the Planned date, if either are modified.

I did that by creating a variable TimeTrackingDays:

{{issue.timetracking.originalEstimateSeconds.divide(28800).floor}}

My idea was to extrapolate the seconds from the Original estimate field, divide it by the seconds in a working day (60*60*8), then using floor to round it down if there are spare hours, which i would put in the variable SpareHours:

{{#=}} ({{issue.timetracking.originalEstimateSeconds}} % (28800)) / (3600) {{/}}

which would calculate the extra hours with the modulo operator %.

These two variables would then be added up to the Planned start date, like so:

{{issue.Planned start.plusBusinessDays(TimeTrackingDays.asNumber).plusBusinessHours(SpareHours.asNumber).jiraDate}}

Problem is, while this may be conceptually correct, I must have made some syntax mistakes because the SpareHours part straight up bugs the rule, which works otherwise.

To solve this problem I tried a less polished solution, which is using the Ceil operator instead of Floor during the days calculation, so if there are spare hours they are automatically converted into a whole working day:

{{issue.timetracking.originalEstimateSeconds.divide(28800).ceil}}

But this seems to not have any effect, which also make me question my use of the floor and ceil operators.

What can I do to solve this?

 

2 answers

1 accepted

0 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 6, 2024

Hello @Filippo Balducci 

Welcome to the Atlassian community.

Is Planned start simply a date field, or is it a date/time field?

If it is simply a date field adding hours to it makes no sense.

I experimented thus and found that when I attempt to add hours to a date-only field, the result is blank.

The first three log actions are logging the Original Estimate and the calculations for Days and Hours of that estimate. Those all work.

The blue arrow shows where I log the value of the date field that I want to modify.

The next green arrow logs where I added only the Days value to the date field. This works.

The two red arrows log where I tried to add the Days and Hours value, and just the Hours value, to the date field. Notice that both of these produce no result.

Screenshot 2024-12-06 at 2.57.30 PM.png

 

As for the floor and ceil functions, I'm not convinced that either of them work properly in this case. I tried both floor and ceil, and in both cases I got "4" as the result.

Filippo Balducci
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 9, 2024

Good morning Trudy, sorry for the late reply. 

Planned start is a Date Picker type, so I can understand now why I couldn't add hours to it. 

I kind of solved the hours problem with

{{issue.timetracking.originalEstimateSeconds.divide(28800).floor}}

as the .ceil operator "converts" the spare hours into a full working day, which doesn't matter if I only see the date without time in the project list. 

How can I see the view you are using to test rules? I don't see it in the audit logs. 

Thank you for all the help, have a good day.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 9, 2024

Hello Filippo,

To what view are you referring?

I produced the image above by have the rule's audit log open in one browser tab, and in another browser tab I was viewing the rule details. I just resized windows so I could look at both side by side.

If you are referring to the "Log action" messages in the audit log, those are produced by adding the Log action components to the rule.

0 votes
Marc - Devoteam
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.
December 6, 2024

Hi @Filippo Balducci 

So you should get 2 numbers from your variables right?

So then add the number of days from the first variable to "Planned Start"

Then update the Planned start field via: {{issue.Planned start.plusBusinessDays({{TimeTrackingDays}})

Then re-fetch the issue data and update the Planned start field again via: {{issue.Planned start.plusHours({{SpareHours}})

 

 

Filippo Balducci
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 6, 2024

Hello again, 

what does re-retching do? Is a double add not possible in one line without it?

Marc - Devoteam
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.
December 6, 2024

Hi @Filippo Balducci 

You cant do a double add, but with math calculation and this is not a calculation.

Re-fetch, is an action that updates the issue info in the rule again, based on previous actions before this one.

And as response to @Trudy Claspill remark. It could be dat using the hour option indeed the result will blank as its a date field you are updating.

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events