How do you get the ticket created date in trac? - trac

I want to play with some really simple queries for a report, but I want to group everything by the creation date. The problem I am having is that time exists in the database, but not the date. From searching around in trac-related resources, it looks like I need to install trac.util.datefmt to be able to extract this information from datetime(time). I can find the API documentation for trac.util.datefmt, but not a download link to get the .egg.
Am I going in the right direction? If I can do what I need (i.e. get the creation month/day/year) without a plugin, what column do I use? I don't see anything else in the schema that is reasonable. If I do need trac.util.datefmt, where do I download it from? And if I really need a different plugin, which one should I be using?

I'll assume Trac >= 1.0. The time column is unix epoch time: the number of seconds that have elapsed since January 1st 1970. You can divide the value by 1e6 and put the value in a converter to see an example of extracting the datetime from the time column. trac.util.datefmt is part of the egg that ships with Trac, but since you are working with reports it doesn't sound like you need to know more about that function to accomplish your aim.
In a Trac report the time column will be automatically formatted as a date. You can look at the default report {1} as an example. I'm not sure how you intend to group by creation date. Do you wish to group tickets created in a certain datetime range?

Related

Is there another way in Qlik Sense to show the latest weeks data by default as well as a filter to change the week you're looking at?

I am looking to add a weekly filter onto my Qlik dashboard to allow me to change the weekly data that is displayed on my dashboard. My original idea works well as I wanted to display the latest weeks data and compare this to the previous weeks and this gives me exactly what I want.
To enhance this and give the dashboard a bit more flexibility and just in case someone wanted to look at a different week, I thought it might be a good idea to add a weekly filter but the way I have built the dashboard won't allow me to do this. The following is an example of what I have:
In my database table I have a rank column (latest_week_rank) where the latest weekending (i.e. Mon 13th to Sun 19th Jan) has a value of 1 and the 2nd latest week would be 2 etc. I have then written the following code in my data tab:
latest_week = 1;
previous_week = 2;
I have then written the following which is then called within a Multi KPI:
vOrdersWTD =Sum({<latest_week_rank = {$(latest_week)}>} total_orders)
This is obviously where the problem lies as having the weekly filter makes no difference as no other weeks show up but I am not sure how I change my code in order to make this all work.
I would really appreciate if somebody could advise on how I can change this around.
Instead of assigning your predetermined variable in set analysis, use the actual field. Something like:
$(=
'Sum({<latest_week_rank = {'
& max(latest_week_rank)+1
& '}>} total_orders'
)

Jira birthday JQL query

I have multiple issues (people) in a Jira cloud instance and they all have a birthday field.
Now, I'ld like to run a JQL to find out if anyone have a birthday today, so I can remind everyone else. Is this possible?
I also have access to the automation for jira plugin if that helps.
Assuming that your birthday field is a valid date, try birthday_field >= startOfDay() AND birthday_field < endOfDay which should give you a result set of people/issues with birthday field value that fall today. For additional references, checkout Function Reference page.
I'm afraid this won't be easily possible.
If the field is date field (e.g. 11/Dec/1979), the birthday is probably stored including year of birth and therefore time functions (now(), startOfDay(), ...) won't work.
If the field is string field (1979-12-11), then you won't be able to compare it with today as you can get now() as a string.
One idea - if you have ScriptRunner installed, create a simple custom scripted field (e.g. Birthday Anniversary) and recalculate original birthday to birthday anniversary this year (11/Dec/2019). You will be then able to compare this field with today, e.g.:
"Birthday Anniversary" = now()
On top of that, once you are able to create such filter, you can create a custom dashboard with today's birthdays and you can subscribe to this filter and get daily overview of today's birthdays.
In my team we send notification about tickets in the following ways:
Jira filters subscription for cases where we need plain(to one person/lead/manager) notification, but without fields analysis
https://confluence.atlassian.com/jira064/receiving-search-results-via-email-720416706.html?_ga=2.134616433.1430628443.1592459825-259335427.1591590509
https://confluence.atlassian.com/jira064/receiving-search-results-via-email-720416706.html?_ga=2.134616433.1430628443.1592459825-259335427.1591590509
https://github.com/dgroup/lazylead for cases where we need automatically check ticket fields, comments, links and alert corresponding person, assignee or reporter.
Please note that i'm author of https://github.com/dgroup/lazylead app.

pulling current date queue

I have a view that lists employee (EmpID), request number (ReqNo), date request was opened (OpenDate) and the date it was moved to the next step in the process (AssignDate). What I am trying to do is get an average of the daily queue size. If EmpID 001 has 20 requests on 1/1/13, then has 24 on 1/2/13, 21 on 1/3/13 the average over 3 days should be 21.66, rounded up to 22. I have the following view:
CREATE VIEW EmpReqs
AS
SELECT [EmpID], [OpenDate], [AssignDate], [ReqID]
FROM [Metrics].[dbo].[Assignments]
WHERE OpenDate BETWEEN '01/01/2013' AND '12/31/2013' AND
[EmpID] IS NOT NULL AND
[ReqNo] NOT LIKE 'M%'
I then wrote a query to pull individual employee's queues per day:
/* First attempt to generate daily queue #s */
SELECT * FROM BLReqs
WHERE [BusLiaison] LIKE 'PN' AND
[OpenDate] <= '11/15/2013' AND
[AssignDate] > '11/15/2013'
Because no one has attempted to pull this information before, I have no way of verifying how accurate the above is. I tried using current dates, since I can see those in our database to compare but the code doesn't work, nothing is returned when I change the dates to 2014 and run my query.
What is the easiest way to verify that my code is correct, short of manually counting a day's queue?
Can anyone see any issues with the above scripts?
Is there a way to get the above code to work with current dates?
This question is really hard to answer because it is kind of broad and has little information at the same time. I'll try anyway:
Because no one has attempted to pull this information before, I have
no way of verifying how accurate the above is.
Try checking the result of this query for a few sampled dates.
I tried using current dates, since I can see those in our database to
compare but the code doesn't work, nothing is returned when I change
the dates to 2014 and run my query.
So clearly, the query is not working. You should probably find out why. Run the query for a date of which you know that it should return results but doesn't. Remove conditions one by one to see which one is incorrectly removing all rows. This should be enough to identify the bug.
Can anyone see any issues with the above scripts?
No, looks fine. A very simple query. That's why I said that we have too little information. There is some key piece of information missing that allows us to find the bug.
Is there a way to get the above code to work with current dates?
Stop staring at the code and hoping for a revelation. Debug it. Experiment.

set date closed trac ticket

I have a set of tickets that were managed via a primitive MS Excel sheet.
The worksheet was as follows
Opened Date | Closed Date | Ticket Content
I want to put them on trac in order to have a complete overview of the tickets opened-closed and the performance of the dev team. However out of the box trac doesn't allow me to set an opened/closed date for a ticket in the past.
Is there a solution for this ?
Some time ago I had a similar demand. I resolved it by batch-import with the help of TicketImportPlugin.
I used a custom field due_date of type text. Calculating POSIX (micro)second time stamp needed some custom formula, but worked sufficiently well. These numbers where imported, and I changed field type to date afterwards. Note that I used a patched Trac code, that entered Trac upstream for version 1.1dev meant for 1.2 now. Another option would be to use the DateFieldPlugin, that deals with date strings internally. But why bother, of you know, that you could use could get true custom time fields supported by Trac core right-away?
I did alter creation date/time too. This has been done by importing another custom field, and copying values back to the time column of ticket db table. A bit of dirty hand-work on configuration and database, but once figured out it worked like a charm and I had 3000+ issues of many years imported with historically correct time stamps in a few minutes.

SQL Filtering based on Calculated Time Slots

Im making a simple booking system for our projectors at work.
Here is the scenario. Each projectors can have its availability set to quarter hour segments throughout the entire day. i.e projector 1 is available between 8:15am - 1:45pm and 3pm-5:15pm each day (can also be changed to have different availabilities set for each day). A projector can be booked for anytime time segment during the day as long as it is available. So ive got that setup in my sql database (with my asp.net mvc front end).
The question i have is what is the best way to search on this scenario. i.e. UserA comes in and says find me the projectors that are available this friday between 12pm-3pm. Im struggling to write an efficient sql query that will filter this. My best option so far is to pull back all projectors and than programatically work out if they are available and not booked between this time. It works but it is incredibly inefficient. I stumbled an idea of using a temp table generated by a stored proc that can than be filtered but it isnt quite there.
Has anyone got any ideas how i could approach this?
Thanks in advance
I would probably have a table called ProjectorReservations which contained a start time and end time (amongst other fields you might care about i.e. who is renting the projector).
Searching a projector would look something like this:
SELECT projectorName
FROM Projectors
WHERE NOT EXISTS
(SELECT 1 FROM ProjectorReservations
WHERE Projectors.projectorName = ProjectorReservations.projectorName
AND (ProjectorReservations.startTime < {end_time}
OR ProjectorReservations.endTime > {start_time}))
That pretty much checks to make sure no reservations start before the one you are looking for ends and vice versa. Obviously you will need to swap in your fields accordingly but that should give you the general idea