Over the last few weeks I was tasked with developing a ticketing system specific to my companies needs. Alright, not a huge deal.. Now I am onto a little trickier subject that I just can’t wrap my head around completely.
Notification System based on a tickets last update time.
Alright so as we all know in a ticketing system we have tickets, lots of them.. Each of our tickets have a ticket “state” such as “Waiting on Client”, “Pending Shipment” etc. These states have different thresholds I.E: 60 minutes, 120 minutes..
Basically I have a server application that runs every two hours. It loops through all the open tickets in the system, checks their ticket state and threshold and if the LastUpdate time is outside of my threshold of 60 minutes then the system fires off a notification saying that this ticket hasn’t been taken care of and someone needs to get on top of it. Alright great, so that means every two hours the system runs it will check the time, if the ticket does not comply with its threshold then a level 2 notification gets sent out. The same process applies for notification 3.
The problem with this scenario is that what happens when Friday rolls around? There may only be 3 tickets that have notifications that need to be sent by the close of business Friday. However when Monday rolls around and this system runs again, it is going to find every ticket out of compliance which means we will more than likely have over 100 tickets in peoples mailbox. This seems like such a common problem among any notification system that operates off a datetime.
Any suggestions?
EDIT: Now that I know it’s a C# app..
When your application is deciding whether or not to send a notification.. first, check if it is the weekend:
Or, you could do this:
So, first check to see if the desired notification time has passed. If it has.. double check if it’s the weekend.. if it is.. add 2 days to the LastUpdate property on this item then exit the function. If its a weekday, it will continue processing. Using this second method, your very first check will be false on the second run-through for all jobs unless they are added on the weekend.
PS: Why don’t you just use a scheduled task and only run it during work hours?