Current system has the following code to compute the average of 5 different number. All have a default value of 0. For example:4+7+4+7+4=26 / 5 =5.2 but system shows 5. Please help how to change my code:
Foremost, this is Misc Custom Field's syntax but you marked JIRA Cloud... I don't believe that Misc Custom Fields is available in JIRA Cloud.
Second, you are using "Integer.parseInt..." Integers by design do NOT handle decimal points. Please modify your code to use a proper type instead of discarding decimals. If you'd like help with your script, please plainly state your use-case.
It would have been enough to divide by 5.0 instead of 5.
int / int = int
int / float = float
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Further to the comment from @Steven Behnke He is correct that the values you are retrieving are all integers hence why when you do the calculation it returns an integer. I believe although I am not an expert in the formats for Misc Custom Fields syntax that the syntax you should be using is
I hope this helps point you in the right direction even if the exact format of the commands is slightly out.
Phill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Phil; It's been quite some time since I've written a calculated field with that add-on. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.