Assuming I have hours per day set at 8 and start time set at 9.00 am how can I narrow down tickets using a JQL filter for tickets created between 9.00 am and 10.00 am? I was thinking something like:
AND updated > startOfDay() AND updated < startOfDay("+1h")
Please see my answer here: Filter issues updated by particular user in period of time using JQL
It seems like you are asking the same question. Hopefully this helps you out.
A scripted field using Script Runner plugin will show the hour:
import java.util.Calendar
Calendar cal = Calendar.getInstance()
cal.setTime(issue.created)
cal.get(Calendar.HOUR_OF_DAY).toString()
Related
I am taking my first steps in Jira automations and I had the following query:
Can I define actions to be executed at a specific time of a day of the week?
I have created the following rule, which I would like for example to be executed on Saturdays. Is it possible to define range of hours and dates?
Thank you very much![enter image description here][1]
JQL: updated >= startOfDay(8h) AND updated <= startOfDay(11h)
How to create a JQL filter to list all tickets created between 8 AM to 4 PM irrespective of created day and date?
I know startOfDay() deal with only for current day. For example , below will list all ticket created of 'myproject' between 8 AM and 4 PM of current day (as per timezone set in my user profile)
created > startOfDay("+8h") and created < startOfDay("+16h") and projecy='myproject'
My requirement is list a ticket created any day (not only current day) in my work shift 8 AM to 4 PM.
Your requirement can not be fulfilled with simple JQL queries. You could query the database directly with some SQL or you can use some scripting with a plugin (check out this post for example).
Other possibilities are to use the JIRA API to receive the ticket data and then filter the tickets which were created in the desired time frame.
Another possibility to at least get the relevant tickets from the current week with a JQL query could be to create a filter like this: created > startOfWeek(7h) AND created <= startOfWeek(17h) OR created > startOfWeek(31h) AND created <= startOfWeek(41h)... (Source)
I'm currently struggeling with the Microsoft Graph REST-API.
What I'm trying to do is list todays events (happening between midnight and midnight). From the documentation, the filter function is very limited.
My current statement looks like this:
https://graph.microsoft.com/v1.0/me/events?$top=100&$select=*&$filter=start/DateTime ge '2017-10-31T00:00:00' AND end/DateTime le '2017-11-1T00:00:00'&$orderby=start/DateTime ASC
The interesting part is here $filter=start/DateTime ge '2017-10-31T00:00:00' AND end/DateTime le '2017-11-1T00:00:00' using the start and the end and checking if start >= TODAY AND end <= TODAY+1. That's all working great for dates that are shorter as 1 day.
My problem is now how to get events that last longer than one day e.g. start = YESTERDAY and end = NEXT WEEK. Which means the start date is before today and the end day is as well not included in this range.
How to get this events?
I believe you should be using Calendar View for your scenario:
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/calendar_list_calendarview
The link that Yogesh referenced seems to be removed and not found. Here is the link that I used which shows how to use the calendar view. Hopefully this helps -- https://learn.microsoft.com/en-us/graph/api/calendar-list-calendarview?view=graph-rest-1.0&tabs=http
For example, let's say I need to find all issues that were resolved within 1 week's time. I need something like:
resolved - created < '1w'
Another example:
Let's say I have 3 issues:
1) created 2 days ago, resolved 1 day ago.
2) created 5 days ago, resolved 4 days ago.
3) created 3 days ago, resolved 1 day ago.
I need a query that will return 1 and 2, but not 3. I need to query for issues that are created at some day X, and resolved <= day X+1.
You have all sorts of control with queries. For example, here is how I check for my tickets that are on hold that I have not updated in the last 5 days.
currentUser() AND status = "On Hold" AND updated <= -5d
Created in the last 5 days would be:
created >= -5d
Resolved in the last 7 days would be:
resolved >= -7d
OR
resolved >= -1w
I don't know if it matters yet but I resolved it with dateCompare():
issueFunction in dateCompare("", "created > resolved -5d"))
So since this does not seemed to be built into JIRA by default my only other suggestion is to see if you can extend JQL to add it.
How's your Java? See how to add JQL to JIRA
So, you want to see all issues where (Resolved date-Create Date) < 1 day
Or 2 days, or 3 days. I think I'd create a (hidden) calculated custom field that shows Resolved-Created and use an Exact Number Searcher on it. Or maybe write a custom JQL function to do the same thing. No way to do it in standard JIRA.
This finds all issues, that were resolved the same day they were created, within the specified period:
project = MyProject AND created >= 2021-11-29 AND created < 2021-12-05 AND issueFunction in expression("", "created.clearTime()==resolutionDate.clearTime()") ORDER BY created DESC, updated DESC
Where this part
created >= 2021-11-29 AND created < 2021-12-05
is any period you're looking for issues within and
issueFunction in expression("", "created.clearTime()==resolutionDate.clearTime()")
is the condition that converts the Date-Time format of "created" and "resolutionDate" to only Date-format and compares the received dates with each other.
The topic's task:
If you add +1 to created.clearTime() - created.clearTime()+1, you will find all issues that were resolved the day they were created and issues that were resolved the next day (+1 day from the creation date).
Note, that you need to use a plugin (I'm using ScriptRunner).
I need to grab the records for same day of the week for the preceeding X days of the week. There must be a better way to do it than this:
Transaction.find_by_sql "select * from transactions where EXTRACT(DOW from date) = 1 and organisation_id = 4 order by date desc limit 7"
It gets me what I need but is Postgres specific and not very "Rails-y". Date is a timestamp.
Anyone got suggestions?
How many days do you want to go back?
I have written a gem called by_star that has a dynamic finder suited for finding up to a certain number of days in the past. If the number of days was always a number you could use this finder:
Transaction.as_of_3_days_ago
If it was dynamic then I would recommend using something such as future or between, depending on if you have transactions in the future (i.e. time travel):
Transaction.future(params[:start_date].to_time)
Transaction.between(params[:start_date].to_time, Time.now)
AFAIK Rails has no any methods to do this by other way. So best, and faster, solution - build DOW index on date column and use your query.