You are on page 1of 3

Project: Employee Room/Seat Allocation

An organization wants to keep records of the room/seat allocation of employees


seated in rooms. The following functionalities are required:
● Every room has a limited capacity, determined by the number of seats
created for any given room.
● Each employee is seated in exactly one room/seat on a particular date.
● The organization intends to maintain historical records of the rooms/seats
allocated to each employee.
● The frequency of room/seat change is less - only happens if the employee
is assigned a different project.
● Whenever an Employee comes to the office, an entry is created that the
Employee is seated on the assigned seat for that day.

A basic Django application is given with following models:


● Employee
○ ID
○ Name
○ Created at
○ Updated at
● Room
○ ID
○ Name
○ Created at
○ Updated at
● Seat
○ ID
○ Number ( S1,S2,S3 etc.)
○ Room ID
○ Created at
○ Updated at

New models can be added and existing models can be updated as required.
We need to build the following APIs:

● List of employees seated in a given room today


● List of rooms with at least X employees seated in them today. X
should be received as query_param, with default value = 15.
● Assign a new seat (can be in the same or different room) to

an Employee from today onwards.

Small functions / Utils:

- Write a query to identify which seat was an employee seated in on a


particular given date?
- Write a query to fetch the room ID in json format ({‘room_id’: XX}) for the
room with the maximum number of seated people.

Expected
- Handle concurrency properly
- Handle all the edge cases
- Code should be clean and maintainable

Code Review Requirements:

Review code present in libs/reporter.py with following requirements in mind:

This Task/Function/Util is supposed to do the following processing.

- A sample JSON would be provided containing in and out timings in


24-hours format. The effective working hours is the difference between
these two values.
- JSON data format: {date1: {employeeId1: {“in”: inTime, “out”:
outTime}, employeeId2: {“in”: inTime, “out”: outTime}}, date2:
{employeeId1: {“in”: inTime, “out”: outTime}, employeeId2: {“in”:
inTime, “out”: outTime}}}
For Example:

{
"2021-04-01":{
"JTG1":{
"in":"09:00",
"out":"18:00"
},
"JTG2":{
"in":"10:00",
"out":"19:30"
}
},
"2021-04-02":{
"JTG1":{
"in":"09:30",
"out":"18:10"
},
"JTG2":{
"in":"10:15",
"out":"18:55"
}
}
}

- This data needs to be processed to generate a CSV monthly report


containing the following data.
- Average in time per employee
- Average out time per employee
- Average working hours per employee
- Number of vacations per employee (less than 2 hours working) -
Number of half-days per employee (more than 2 and less than 6
hours working)

To give review comments add `comment` above the line in the format:

- [REVIEW] <review_comment>

For example:

def test_function(arg1)
# [REVIEW] perform_action takes 2 arguments as input
perform_action(arg1)

You might also like