Forums

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

Getting timespent value as negative (using api url as https://xyz.atlassian.net/rest/api/2/se)

Rashi Goyal October 14, 2020

Hi Team,

Running one API using the URL: https://xyz.atlassian.net/rest/api/2/search?jql=&startAt=".$s."&expand=changelog.

I am getting a response but I am confused in one thing please guide.

Issue is :

Whenever I am trying to get the logged hours from the array (to field- from field from the array) I am getting a negative value for some records.

FYI as guided by @Warren I am fetching the value from the items array(where field id is timespent).

@Warren any help from your side will help me a lot. Please check

Anyone else has any idea for the same please guide

Thanks in advance

Rashi

1 answer

0 votes
Warren
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.
October 14, 2020

Hi @Rashi Goyal 

Are you saying that you're using  toField minus fromField?

And that the result is ALWAYS negative?

It should always be positive because, as time is logged, that field should just get bigger and bigger.

There are a few things to check :

  1. Please step through the code and make sure that you haven't somehow swapped variables around and you're actually doing "fromField - toField"
  2. Those fields in the JSON are "string" values, so make sure that your conversion to a number is working correctly
  3. If 1 and 2 above don't resolve this, go into an issue in Jira, click on the History tab and then search for Time Spent. Check that the numbers are increasing, as below

Screenshot_3.jpg

Rashi Goyal October 14, 2020

@Warren not all results are negative.

I am using it as (to - from) only as mentioned by you. Also, the format is correct

Like for example, I got a record for a single user across a particular task:

1st entry = -900(0.25 hrs)

2nd entry = 9900(2.75 hrs)

And in actual she logged 2hrs 30m i.e. (2.75 - 0.25 = 2.50)

But my concern is that what that negative value indicates and for which purpose API is logging that.

Hope you get my point. Please guide.

Also, guide me in one other thing that if I am logging my hours on 14-oct and selecting the date as 13-oct while logging then the created field in our array will show which date?

Rashi

Warren
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.
October 16, 2020

Hi @Rashi Goyal 

Could you please find the entry listed above (the 2.5h) in Jira's History section and give me a screenshot - I'd really like to see what shows there

Rashi Goyal October 22, 2020

@Warren can you share your skype id? so that I can sync a quick call to clear my doubts and confusion.

I am developing a software in which I have some checkpoints written to clear the approach. So, it will be good if we can connect directly.

Thanks,

Rashi

Suggest an answer

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

Atlassian Community Events