Last active
May 24, 2018 18:34
-
-
Save nohtyp/9cfffcb720a72c741bf737bec3da3bcd to your computer and use it in GitHub Desktop.
Jira SIL code to get x comments from issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is the name of the column "Latest comments SIL" code will need to be optimized (first sil script) | |
int lastnumOfComments = 3; | |
string [] allcmt; | |
number [] allCommentIds = getAllCommentIds(key); | |
int t = 0; | |
int arrsize; | |
int mcomments; | |
if (!isNull(allCommentIds)) { | |
if (size(allCommentIds) < lastnumOfComments){ | |
return "Not enough comments"; | |
} | |
else { | |
arrsize = size(allCommentIds); | |
mcomments = arrsize - lastnumOfComments; | |
if (mcomments == 0) { | |
for(number x in allCommentIds){ | |
allcmt = allcmt + "\n---Comment---\n" + getCommentById(x).text; | |
} | |
return allcmt; | |
} | |
else { | |
for(number x in allCommentIds){ | |
if (t >= mcomments and t <= arrsize){ | |
allcmt = allcmt + "\n---Comment---\n" + getCommentById(x).text; | |
} | |
else { | |
t = t + 1; | |
} | |
} | |
return allcmt; | |
} | |
} | |
} | |
else { | |
return "No comments available"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment