MakeMyTrip | Virtual | Allocation Problem without "OR" Operator

Allocation Problem without "OR" Operator

There is a system which solves allocation problem in a ticketing platform. The ticket with highest priority should get allocated first.
All the tickets are stored in a tabular format as below. (Only the sample set, as the number of rows can be much more )

ticketid priority escalationlevel queueid status centerpreference assignee allocationstarttime allocationendtime
4001 100 0 Q1 OPEN 0 NULL 5:00 AM 6:00 AM
4002 90 2 Q1 OPEN 0 5:00 AM 7:00 AM
4003 80 1 Q2 OPEN 1 NULL 6:00 AM 9:00 AM
4004 170 0 Q1 REOPEN 0 NULL NULL
4005 60 0 Q1 CLOSED 0 mmt9568 7:00 AM 8:00 AM

The algorithm should pick the ticket with highest priority having below conditions :-

  • The ticket that should be picked should only have state OPEN or REOPEN.
  • (Escaltionlevel will be input to the algorithm ) The algorithm should run per escalation level I.e. the tickets cannot be combined and searched for all escalation level but on demand for a particular escalation level.
  • (QueueId with centre preference will be input to the algorithm )The algorithm should run per queue. Each queue can have centre preference.
  • Only unassigned ticket will be picked for allocation i.e. having assigneee null or blank.

To write above algorithm , only one condition to be kept in mind, i.e. there is no OR operator that exists in the system.

I tried using nested IFs both in the SQL statements and in code, but didn't work out as a plausible solution

Comments (1)