You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Our oncall week starts from Thursday to next Wednesday.
I want to build a filter for search all tickets that crated during these 7 days.
The oncall week is across 2 weeks. startOfWeek may not work as expected.
project = "Oncall" AND created >= startOfWeek(4d)
This will work in Thursday, Friday Saturday of the week-1, but it may not work for Sunday, Monday, Tuesday, Wednesday of the week-2.
On-call week
+-----------------------+
| |
SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT
| | | |
+---+---+ +-----+-----+
| | in these days we need to use:
| +-----> created >= startOfWeek(-3d)
|
| in these days we need to use:
+--> created >= startOfWeek(4d)
How can I combine them to one single JQL, something like this
(created >= startOfWeek( 4d) AND now().dayOfWeek() in (THU, FRI, SAT)) OR (created >= startOfWeek(-3d) AND now().dayOfWeek() NOT IN (THU, FRI, SAT))
But now().dayOfWeek() doesn't work in JQL.
I finally cracked it.
My actually use case is that the oncall started from Tuesday. (I used Thursday as start day in the question for easy to describe).
created >= startOfWeek(2d)
This will work well, when the time is in first week(Tuesday ~ Saturday).
But it will select nothing when the time enters the 2nd week(Sunday and Monday) because `startOfWeek(2d)` means current week's Tuesday which is in the future.
Suppose it is Sunday now. (Apparently it is 2nd week's Sunday), how can I match the JIRA of last Tuesday, Wednesday, Thursday, Friday and Saturday?
(created >= startOfWeek(-5d) and created < startOfWeek(-4d)
matches last Tuesday.
created >= startOfDay(-5d) and created < startOfDay(-4d))
matches the day before 5 days
So the following criteria would match (the last Tuesday which is before 5 days)
(created >= startOfWeek(-5d) and created < startOfWeek(-4d) and created >= startOfDay(-5d) and created < startOfDay(-4d))
Only on Sunday it could match JIRAs. It won't match anything on any other day, for the day before 5 days wouldn't be Tuesday on any other days.
By this way, we can build criteria which would only valid on Sunday:
Also we can build criteria which would only valid on Monday:
Here is my solution -
(created >= startOfWeek(2d) OR
created >= startOfDay() OR
(created >= startOfWeek(-5d) and created < startOfWeek(-4d) and created >= startOfDay(-5d) and created < startOfDay(-4d)) OR
(created >= startOfWeek(-4d) and created < startOfWeek(-3d) and created >= startOfDay(-4d) and created < startOfDay(-3d)) OR
(created >= startOfWeek(-3d) and created < startOfWeek(-2d) and created >= startOfDay(-3d) and created < startOfDay(-2d)) OR
(created >= startOfWeek(-2d) and created < startOfWeek(-1d) and created >= startOfDay(-2d) and created < startOfDay(-1d)) OR
(created >= startOfWeek(-1d) and created < startOfWeek() and created >= startOfDay(-1d) and created < startOfDay()) OR
(created >= startOfWeek(-5d) and created < startOfWeek(-4d) and created >= startOfDay(-6d) and created < startOfDay(-5d)) OR
(created >= startOfWeek(-4d) and created < startOfWeek(-3d) and created >= startOfDay(-5d) and created < startOfDay(-4d)) OR
(created >= startOfWeek(-3d) and created < startOfWeek(-2d) and created >= startOfDay(-4d) and created < startOfDay(-3d)) OR
(created >= startOfWeek(-2d) and created < startOfWeek(-1d) and created >= startOfDay(-3d) and created < startOfDay(-2d)) OR
(created >= startOfWeek(-1d) and created < startOfWeek() and created >= startOfDay(-2d) and created < startOfDay(-1d)) OR
(created >= startOfWeek() and created < startOfWeek(1d) and created >= startOfDay(-1d) and created < startOfDay()))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
project = "Oncall" AND created >= startOfWeek(-3d)
When the time is 2nd week, it works.
When the time is 1st week (Thursday, Friday, Saturday), it doesn't work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The issue is you want to use an IF condition in your JQL but as far as I know there is no IF in JQL.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, it is not "IF"
It need something like this:
(created >= startOfWeek( 4d) AND now().dayOfWeek() in (THU, FRI, SAT)) OR (created >= startOfWeek(-3d) AND now().dayOfWeek() NOT IN (THU, FRI, SAT))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Let me reformulate my "IF" comment :)
I think this is your requirement:
IF Today = Monday
issues from last week Wednesday till Today
Else IF Today = Tuesday
issues from last week Wednesday till Today
Else IF Today = Wednesday
issues from Today
Else IF Today = Thursday
issues from this week Wednesday
....
So you need to know what is the day today. But from JQL you cannot get this, from JQL you can get Issues based on some criteria.
Is that a solution to create separate filters (naming them as Monday, Tuesday, etc.) and use them as Quick Filters - selecting every day the relevant one?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.