Forums

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

Script adds a 0 when user has language as Spanish, help?

laralg
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.
February 19, 2019

Hello, I am using a script that adds-up the story points of all the issues in the epic, but, when users who have their language as spanish see the result it adds a 0.

I think it is because Jira says the number is 10.0 and in spanish dots are for decimals so it puts 100, but I do not know how to fix it.

The script is:

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor;
def componentManager = ComponentManager.getInstance()
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def cfManager = ComponentAccessor.getCustomFieldManager()
double totalSP = 0
customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_10106");
enableCache = {-> false}

issueLinkManager.getOutwardLinks(issue.id)?.each {issueLink ->
if (issueLink.issueLinkType.name == "Epic-Story Link" ){
double SP = (double)(issueLink.destinationObject.getCustomFieldValue(customField) ?: 0)
totalSP = SP + totalSP;
}}
return totalSP

1 answer

1 accepted

0 votes
Answer accepted
laralg
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.
February 20, 2019

Fixed! If I use as a template text instead of number it does not add the dot!

Suggest an answer

Log in or Sign up to answer