开发者

A ridiculously complicated business days/hours/minutes sla calculation to figure out

Okay, I've been going round in circles for the last 2 days trying to figure this one out.

I am working on a system that handles 'cases'. Each case has a type and each type has an associated SLA which can be specified in days, hours or minutes. In addition to this there is an administrative function which allows the user to specify the start and end time of the working day and which days in the week are worked. I should point out that working hours are the same for every working day. So for example, the working hours might be 9:00 to 13:30 on a Monday, Wednesday and Thursday. I'm not going to bother including h开发者_JAVA技巧olidays in this function just yet...It's tough enough as it is!

Given the days and hours that are worked and the SLA,.. how can I calculate the date and time when the case breaches it's SLA.

I get the feeling that since the minimum resolution of an SLA is set in minutes, I'll need to convert everything to minutes first. Obviously the day/time that the case is created will have to be taken into account too. Other than those two nuggets of wisdom I'll be honest,...I'm floundering :-)

Absolutely any help would be hugely appreciated on this. It's probably also worth mentioning that if there is a library out there to do this I'm happy to use it and move on. C# is my preferred language but any solution would be great

Lots of thanks in advance.


Personally I would have a list of days in the week and the number of working minutes in each day. Loop through the list subtracting working minutes from the task until it is 0, while adding a full day's worth of minutes to a "real-world time to completion" variable.

If the task's remaining minutes are less than a day's working minutes then add those to the time to completion variable instead.

That tells me how may minutes between task start and task completion, which can be compared to the type's SLA.

Not sure if it's the best way but it's a start :) Hope it helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜