Programming JIRA to show # of bugs and calculate time spent - jira

I would like to program a filter in JIRA to show the number of bugs for a sprint and also calculate time spent. I have tried a number of the current reports but they do not automate this calculation. Has anyone successfully done this? I would prefer to do this via JQL rather than using the API.

With the standard JIRA functionality, the "issue search" page does not offer you a way to summarise values (yet).
There are a number of add-ons that can help you accomplish this though, for example:
sumUp
There is the sumUp add-on which does exactly that and is probably the easiest option.
Script Runner
You could also use Script Runner and its aggregateExpression JQL function, which supports "time spent" and other time fields and can give you a view like this:
Script Runner also has a ton of other useful features to customise JIRA.
Pivot Gadget
And if you're looking for a gadget to add on a dashboard instead, you could also use the Pivot Gadget add-on. This one supports pivot tables and can sum up totals, so you get something like this:
No Add-Ons Possible: Use the JIRA REST API
If installing add-ons is not an option, then you can still script a solution using JIRA's REST API. Especially the search resources will be useful.
You can use any kind of programming or scripting language to build this. There's already another answer that explains how to do this with bash, but if you google you will also find JIRA REST client libraries for java, python, ...
Also, most programming languages have very good REST support, so use whatever you are familiar with.

#GlennV is right - JQL is not SQL, and it returns only issues, not issue fields.
If you have the plugins he mentions, you should follow his guidelines.
If not, using the REST API gets you exactly what you need, even if you're loathe to use it :)
For my project key "MRL", I called:
https://my-jira-server/rest/api/latest/search?jsql=project=MRL%20AND%20issuetype=Bug
This returned a whole bunch of JSON info which I can then parse to get only the timeSpent field
If you're lucky enough to be on linux, you can use jq to quickly count the hours with this filter:
[.issues[] | .fields | select (.timespent != null) | .timespent] | add
If you want to try it, copy the entire JSON you got when you ran the REST API (the searchjql link), go to https://jqplay.org/, paste it into the JSON field, and paste the filter into the filter field.
I wrote a blog about something like this which you might want to refer to:
http://javamemento.blogspot.no/2016/05/jira-confluence-3.html

Related

JQL query to filter JIRAs based on the last commented date by a particular account / user

I am new to JIRA / JQL, and wanted help in knowing if the following is possible:
I want to filter JIRAs which have been commented on by a particular user (a bot account) in the past xx days
I want to filter JIRAs which have a particular regex in its comments in the past xx days
If the above cannot be done, I am open to suggestions as to how to achieve it using a combination of labels and description in the JIRA!
Sorry, but comments are stored within each Issue and you can't search for them globally using the native JQL query. You'd need to utilise the REST API to iterate through the Issues, extracting all the comments, then filtering the results.
Refer to this article in the Atlassian community Jira blog on the same topic and what third party tools can help work around the issue.

JQL to get blocked Issues

Is there a native JQL (not a plugin) that returns tickets that have linked issues listed as "is blocked by" (so I can see all my blocked tickets).
All I have found is linkedIssues() but that can require a specific issue ID to search for which is entirely unhelpful.
I am using Jira Cloud 7.4.
In the core JIRA JQL functionality the closest thing you have, as you've already found out, is linkedIssues() that requires a parent Issue reference.
What you need is Adaptavist ScriptRunner, they have a function called hasLinks(). There are also a handful of other add-ons that offer this functionality but like ScriptRunner, they all cost money.
Related JIRA community question
JIRA Cloud feature request
The below query is also helpful (add it in the filter setup):
project = "Project ID" AND issuetype in (story, Spike) AND Sprint = "Sprint ID" AND linkedIssue in issueHistory()
According to Esther Strom's answer on this Atlassian site, there's a new query type:
Atlassian has very recently introduced a new JQL function called issueLinkType, which can be used in filters, but also in boards.
It's not perfect; if you're already using card colors for something else, you won't be able to use this as well. It also behaves inconsistently when a ticket has links of multiple types. But if you're looking for an easy way to get a view into what might be blocked, and what might have blockers, it works pretty well.
In KQL you can specified the type of link.
For what you want to do here what you can use
issue in linkedIssues([Issue#],"is blocked by")

Performing Google Search In Spreadsheet And Scraping The SERP Data

I hope that you guys are fine. I want to build a simple spreadsheet and I thought I could be able to make one but blank sheet looks horrible to me. I am sure that you guys are kind enough to help me out.
I want to perform multiple Google search queries in Google spreadsheet and want to parse results of each search (top 10 results of each search)
Something like this: https://www.youtube.com/watch?v=tBwEbuMRFlI
But when I tried his given formula in description to play test, Google returned #Error to me, I don't know why.
Can you guys please help me out in making a simple spreadsheet compatible for multiple queries at once? Like one column for keywords (where I could paste my list of keywords) and then 10 columns of search results. All results for one keyword should come in one row
Something like this:
My 1st Example Query = 1st search result, 2nd search result, 3rd result and so on.
My 2nd Example Query = 1st search result, 2nd search result, 3rd result and so on.
It must be easy to code but yeah, it might be time-consuming and I would be very grateful if anyone of you could help me about it.
Looking forward to your help guys.
The problem is that you want to scrape out of Spreadsheets, that's a bad approach and is almost certainly not going to work. Even if you manage to write a scraper inside that limited environment it will easily be spotted by Google.
As you said time is not a problem, I would suggest another route.
Use a backend tool/script that scrapes the data
Use a backend tool/script that creates/modifies the Google spreadsheet
You can run such a script(s) manually on your PC or from a server full automated using a scheduler/cron job.
To create/modify spreadsheets look here: How do I access the Google Spreadsheets API in PHP?
To scrape Google look here: Is it ok to scrape data from Google results?
So this is PHP as language of choice but you can do the exactly same in Java or Python or C#
There is a third party solution like SerpApi you could use for this. It's a paid API with a free trial.
Google Sheets Add-on: SerpApi - Search Engine Results and Ranks
Example code to extract title from the first result:
=SERPAPI_RESULT("engine=google&q=coffee&location=Austin, Texas, United States&google_domain=google.com&gl=us&hl=en", "organic_results.0.title")

Jira to know how many poeple have visited an issue

I want to know how many people have visited a particular isssue in order to know its popularity( I can't trust on number of watchers of the issue) .Is there any way (JiraDB or anything) by which i can know how many people(just the count) have visited any particular issue.
The question can be modified like this : Top 10 mostly visited issues in a week or so.
Seb's earlier answer provides a possible solution for JIRA Cloud. I am not aware of any off-the-shelf product for behind-the-firewall installations of JIRA, and I do not believe that views are tracked anywhere in the JIRA database.
For behind-the-firewall instances, you could certainly write a script to parse the JIRA access logs (stored in $JIRA_HOME/logs/access_log*) to count issue accesses that way.
The JIRA access logs are stored in a format that is similar to the Apache access log format, so you just need to parse out accesses to individual issues by looking for URLs of the format "http://MYJIRA/browse/ABC-123".
Out of the box this is not possible. Jira does not log view counts for single issues.
You could have a look if there is any plugin for this at https://marketplace.atlassian.com/search?application=jira
E.g. https://marketplace.atlassian.com/plugins/communardo.connect.usage.statistic.addon looks like it could fit your requirements, but I personally have never heard of it.

Search Engine Help

I have a mediawiki installation that I've customized with some of my own extensions. Here is the basic platform, pretty standard LAMP install.
Ubuntu Server
Apache 2
Mediawiki 1.15
PHP 5.2.6
MySQL 5.0.67
For the actual MW search I use Lucene (EzMwLucene). I also have custom extension that displays tabular data from a separate database within a MW page. Lucene doesn't index this info (which, in my case is actually good because it would clutter your expected search results). For this installation I didn't do anything to Lucene other than install it and wouldn't know how to customize it for my needs and it may be "too powerful".
At any rate, I need to create a search for the data in my other database. I have a master table that is updated daily based on data stored in other (normalized) tables. At the moment it is one of these searches that basically creates a SQL query based on the criteria you enter. This is a lot of work, though. I would like it to be more of a "type and submit" type search.
I don't think I need a comprehensive "cut & paste" type answer, but if anybody has something that I can google I would be very appreciative. I don't need to recreate the wheel, which is what I would be doing if I followed what I see in google.
If you would like to see my master database, let me know, I would want to sanitize it to make me more anonymous (whatever that means). Also, if you're familiar with MW and would like to see any of my extension code, again, let me know.
TL;DR: need to make a custom search feature with LAMP (displayed in Mediawiki). Any guidance appreciated.
Thanks SO!
Why do you need to add custom search? This will relate to the best answer.
For simplicity, you could use the Google Search Engine - http://www.mediawiki.org/wiki/Extension:Google_Custom_Search_Engine
Otherwise it sounds like you need to write a full-text query for the database.

Resources