Jira JQL decode Monday Tuesday etc - jira

Has anyone managed to create a query that returns data based on Monday Tuesday Wednesday next week?
I can get a result with startofweek(1) and endofweek(1) but that doesn't break down to each day.
Ideally I'd get a result like this:
Monday | Tuesday | Wednesday | Thursday | Friday |
--------------------------------------------------
Card1 Card1
Card3 Card4
Card5
Any help would be appreciated.

I believe that is not possible. Columns on Jira boards are configurable by issue status, not via JQL. However, you could do the following:
1) Add a quickfilter for each weekday. JQL actually is more powerful as it looks on first sight: You can use expressions like "status changed ON ..." - enabling you to observe issues that were touched at these days. This would per filter show a single day only on the board, since filters are internally combined via AND.
2) Do the same JQL but with swim lanes. You could see each day on the board at the same time in a separate swimlane. But I consider this mind-twisting.
You should write a more elaborate JQL that fits what exactly you want to see, of course. There is another way, though you'd need (low) programming skills:
3) Use Jira REST API to fetch your sprint/week data and throw it in a grid that suits your needs yourself.

Related

Can i create a sum using a key? Absence tracker

I’ve been tasked with creating an absence tracker that will monitor holidays and sickness - I have created the basic layout and a key which determines holiday = H half day morning =Hd1 absence = A etc ...
So the premise is obviously if employee 1 is on holiday you would enter H in the relevant date cell, off sock you would enter A.
What I’m struggling with is the correct formula to add them up each month so absence will be separate and not so much of an issue, but say they have Monday on holiday, and Tuesday as a morning on holiday and then they’re off on compassionate leave on Friday at the end of the month there would be 3 days authorised leave, I’m confused how I put that in a formula.
Try something like this, using countif formula:
=countif(D$6:D$34,$C2)
My solution is available here:
https://docs.google.com/spreadsheets/d/1_oCCsuvseJUqrjWgjDKesON9CSFLZTXxQvYAG8T5Cwk/copy

Match date in two cells with conditional formatting, +/- 3 days.. Google sheets

I am making a deadline sheet for office.
I have made a conditional format that compares the dates with our "office are closed"-dates provided by our HR-department. If the delivery date match any of the "office closed"-dates in the next column it will be coloured red.
This works fine, but I just noticed one thing. If the date where 1 day before the holidays, and the holidays would be many days a row starting next day, we wouldn't see that and we would probably get big trouble manage Finnish these masters before deadline as we are not at office for a few days.
So, I thought, maybe I could add to the script something that says: "compare the dates in this column with the dates in "Office Closed"-column, if there is a match within a range of 5 days, color it red...?
Is this something I can do?
here is a screenshot of the sheet.
This is the code I use in Conditional Formatting now:
=COUNTIF($L$4:$L$25,H6)>0 which works fine.
Thanks for any help!
/Andreas
Use following formula in CF:
=IF(LEN(A2),SUMPRODUCT((($C$2:$C+3)>=A2)*(($C$2:$C-3)<=A2)))

Store the day of the week and time?

I have a two-part question about storing days of the week and time in a database. I'm using Rails 4.0, Ruby 2.0.0, and Postgres.
I have certain events, and those events have a schedule. For the event "Skydiving", for example, I might have Tuesday and Wednesday and 3 pm.
Is there a way for me to store the record for Tuesday and Wednesday in one row or should I have two records?
What is the best way to store the day and time? Is there a way to store day of week and time (not datetime) or should these be separate columns? If they should be separate, how would I store the day of the week? I was thinking of storing them as integer values, 0 for Sunday, 1 for Monday, since that's how the wday method for the Time class does it.
Any suggestions would be super helpful.
Is there a way for me to store the the record for Tuesday and
Wednesday in one row or do should I have two records?
There are several ways to store multiple time ranges in a single row. #bma already provided a couple of them. That might be useful to save disk space with very simple time patterns. The clean, flexible and "normalized" approach is to store one row per time range.
What is the best way to store the day and time?
Use a timestamp (or timestamptz if multiple time zones may be involved). Pick an arbitrary "staging" week and just ignore the date part while using the day and time aspect of the timestamp. Simplest and fastest in my experience, and all date and time related sanity-checks are built-in automatically. I use a range starting with 1996-01-01 00:00 for several similar applications for two reasons:
The first 7 days of the week coincide with the day of the month (for sun = 7).
It's the most recent leap year (providing Feb. 29 for yearly patterns) at the same time.
Range type
Since you are actually dealing with time ranges (not just "day and time") I suggest to use the built-in range type tsrange (or tstzrange). A major advantage: you can use the arsenal of built-in Range Functions and Operators. Requires Postgres 9.2 or later.
For instance, you can have an exclusion constraint building on that (implemented internally by way of a fully functional GiST index that may provide additional benefit), to rule out overlapping time ranges. Consider this related answer for details:
Preventing adjacent/overlapping entries with EXCLUDE in PostgreSQL
For this particular exclusion constraint (no overlapping ranges per event), you need to include the integer column event_id in the constraint, so you need to install the additional module btree_gist. Install once per database with:
CREATE EXTENSION btree_gist; -- once per db
Or you can have one simple CHECK constraint to restrict the allowed time period using the "range is contained by" operator <#.
Could look like this:
CREATE TABLE event (event_id serial PRIMARY KEY, ...);
CREATE TABLE schedule (
event_id integer NOT NULL REFERENCES event(event_id)
ON DELETE CASCADE ON UPDATE CASCADE
, t_range tsrange
, PRIMARY KEY (event_id, t_range)
, CHECK (t_range <# '[1996-01-01 00:00, 1996-01-09 00:00)') -- restrict period
, EXCLUDE USING gist (event_id WITH =, t_range WITH &&) -- disallow overlap
);
For a weekly schedule use the first seven days, Mon-Sun, or whatever suits you. Monthly or yearly schedules in a similar fashion.
How to extract day of week, time, etc?
#CDub provided a module to deal with it on the Ruby end. I can't comment on that, but you can do everything in Postgres as well, with impeccable performance.
SELECT ts::time AS t_time -- get the time (practically no cost)
SELECT EXTRACT(DOW FROM ts) AS dow -- get day of week (very cheap)
Or in similar fashion for range types:
SELECT EXTRACT(DOW FROM lower(t_range)) AS dow_from -- day of week lower bound
, EXTRACT(DOW FROM upper(t_range)) AS dow_to -- same for upper
, lower(t_range)::time AS time_from -- start time
, upper(t_range)::time AS time_to -- end time
FROM schedule;
db<>fiddle here
Old sqliddle
ISODOW instead of DOW for EXTRACT() returns 7 instead of 0 for sundays. There is a long list of what you can extract.
This related answer demonstrates how to use range type operator to compute a total duration for time ranges (last chapter):
Calculate working hours between 2 dates in PostgreSQL
Check out the ice_cube gem (link).
It can create a schedule object for you which you can persist to your database. You need not create two separate records. For the second part, you can create schedule based on any rule and you need not worry on how that will be saved in the database. You can use the methods provided by the gem to get whatever information you want from the persisted schedule object.
Depending how complex your scheduling needs are, you might want to have a look at RFC 5545, the iCalendar scheduling data format, for ideas on how to store the data.
If you needs are pretty simple, than that is probably overkill. Postgresql has many functions to convert date and time to whatever format you need.
For a simple way to store relative dates and times, you could store the day of week as an integer as you suggested, and the time as a TIME datatype. If you can have multiple days of the week that are valid, you might want to use an ARRAY.
Eg.
ARRAY[2,3]::INTEGER[] = Tues, Wed as Day of Week
'15:00:00'::TIME = 3pm
[EDIT: Add some simple examples]
/* Custom the time and timetz range types */
CREATE TYPE timerange AS RANGE (subtype = time);
--drop table if exists schedule;
create table schedule (
event_id integer not null, /* should be an FK to "events" table */
day_of_week integer[],
time_of_day time,
time_range timerange,
recurring text CHECK (recurring IN ('DAILY','WEEKLY','MONTHLY','YEARLY'))
);
insert into schedule (event_id, day_of_week, time_of_day, time_range, recurring)
values
(1, ARRAY[1,2,3,4,5]::INTEGER[], '15:00:00'::TIME, NULL, 'WEEKLY'),
(2, ARRAY[6,0]::INTEGER[], NULL, '(08:00:00,17:00:00]'::timerange, 'WEEKLY');
select * from schedule;
event_id | day_of_week | time_of_day | time_range | recurring
----------+-------------+-------------+---------------------+-----------
1 | {1,2,3,4,5} | 15:00:00 | | WEEKLY
2 | {6,0} | | (08:00:00,17:00:00] | WEEKLY
The first entry could be read as: the event is valid at 3pm Mon - Fri, with this schedule occurring every week.
The second entry could be read as: the event is valid Saturday and Sunday between 8am and 5pm, occurring every week.
The custom range type "timerange" is used to denote the lower and upper boundaries of your time range.
The '(' means "inclusive", and the trailing ']' means "exclusive", or in other words "greater than or equal to 8am and less than 5pm".
Why not just store the datestamp then use the built in functionality for Date to get the day of the week?
2.0.0p247 :139 > Date.today
=> Sun, 10 Nov 2013
2.0.0p247 :140 > Date.today.strftime("%A")
=> "Sunday"
strftime sounds like it can do everything for you. Here are the specific docs for it.
Specifically for what you're talking about, it sounds like you'd need an Event table that has_many :schedules, where a Schedule would have a start_date timestamp...

Returning Modified Following business date while building Quarterly calendar

Trying to build a quarterly calendar of working business days (adjusted by holidays).
I am using =edate (A1,4), the only problem is that this function does not adjust for business days. Ideally I would wrap the formula using =workday(edate(A1,4),0,USD_Hols) but it seems that I cannot just add "0" for the formula to return the next business day.
Does anyone know how to get the next business day and also if next business day falls in the next month return the nearest previous business day?
Thanks
Paco
I think this works based on your description on comments. I'm not quite sure what you mean by "previous" in the comment. Below, I'm assuming that it means A1, if A1 is a workday, or the workday before A1 if A1 is not a workday:
=IF(MONTH(WORKDAY(A1,1,USD_Hols))=MONTH(A1),WORKDAY(A1,1,USD_Hols),WORKDAY(WORKDAY(A1,1,USD_Hols),0-1,USD_Hols))
I haven't used workday functions much. One thing I notice is that a 0 argument for days seems to return the date in A1 even if it's not a workday. That's why I included the nested IFs in the ValueIfFalse part of the main IF. It forces it to the next workday and then the one previous to that.
You must add the worksheetfunction to the Workday to Excel 2010
This is correct:
Function NextBiz(d As Range, holidays As Range) As Date
If WorksheetFunction.Weekday(d) = 7 Or WorksheetFunction.Weekday(d) = 1 Or WorksheetFunction.CountIf(holidays, d) > 0 Then
NextBiz = WorksheetFunction.WorkDay(d, 1, holidays)
Else: NextBiz = d
End If
End Function

Language to express complex time multi-intervals?

I'm wondering if anyone knows of any declarative language to express absolute date-time multi-intervals. I mean sets which are the union/intersection/complement of time intervals.
Intervals I would like to represent are like:
(
(from the second day of the month to the 10th) intersection (months 1,2,3,10)
)
union
(
(from the second monday of january to the 3rd of july) intersection (not in(mondays, fridays))
)
I'm not looking for a library, but rather to some language specification.
An example of what I'm looking for are the cron expressions you can find here.
It seems somebody has finally devised a dsl just for that: schyntax .
Well, you might not be looking for a library, but the JODA library for Java, when in use, comes close in structure of it's usage to what you have shown. Do look at it.
A dialect of SQL, maybe?
Date from Days
where Month in (Jan, Feb, Mar, Oct)
and Day between 2 and 10
union
Date from Days
where Date between SecondMondayOf(Jan) and July,3
and DayOfWeek not in (Mon, Fri)

Resources