Employee Performance problem statement folder consists solution file for the same.
Need Visual studio and .net6 installed.
- Clone Repo SoniJai/WUElev8
- Open Visual Studio.
- Open solution file present at WUElev8\Employee performance problem statement\EmployeePerformanceProblem\EmployeePerformanceProblem.sln.
- Run EmployeePerfromanceProblem.Api Project.
- Run Api : api/EmployeePerformance/teamEffort for teamEfforts calculation problem.
- Run Api : api/EmployeePerformance/lowestEmployeeEfficiency for lowest n employees problem.
Api Call : GET https://localhost:7226/api/EmployeePerformance/teamEffort
Response:
[
{
"team": "Design",
"projects": [
{
"projectName": "AAA",
"hours": 3.9722222222222225
},
{
"projectName": "CCC",
"hours": 4
},
{
"projectName": "DDD",
"hours": 2.621794871794872
}...
]
},
{
"team": "Dev",
"projects": [
{
"projectName": "BBB",
"hours": 5.869565217391305
},
{
"projectName": "CCC",
"hours": 3.5517241379310349
},
{
"projectName": "DDD",
"hours": 3.9606060606060606
}...
}...
]
API Call: https://localhost:7226/api/EmployeePerformance/lowestEmployeeEfficiency?n=5
Response:
[
{
"employeeName": "0",
"hours": 0.5
},
{
"employeeName": "Gerard Benedict",
"hours": 16.520000000000003
},
{
"employeeName": "rajeshwaran",
"hours": 23.5
},
{
"employeeName": "shalini",
"hours": 40.790000000000006
},
{
"employeeName": "akarthick",
"hours": 44.75
}
]
ReminderServiceProblem folder consists solution file for the same. This solution provides api for to add reminder. In background, the reminder are added to a collection at a given reminder time. This solution consists an API project to add/get reminders and WorkerService project which continuoulsy polls the reminder tasks and add them to queue at correct time.
- Clone Repo SoniJai/WUElev8
- Open Visual Studio.
- Open solution file present at WUElev8\ReminderServiceProblem\ReminderServiceProblem.sln
- Run ReminderServiceProblem.Api Project.
- Run Api : POST api/TaskReminder to add new TaskReminder.
- Run Api : GET api/TaskReminder to get all the tasks.(There are some existing tasks as well.).
- You should be able to see newly added task in response of GET api call.
- Now check the console window of current running api project.
- You should be able to see that the reminders are being added to queue at the correct time.
- You can compare the reminder time of tasks from GET call output to console logs.
For Ex.:
GET TaskReminder api returns:
[
{
"name": "A",
"reminderTime": "2022-08-27T16:55:35.4843825+05:30"
},
{
"name": "B",
"reminderTime": "2022-08-27T16:55:40.4856986+05:30"
},
{
"name": "C",
"reminderTime": "2022-08-27T16:55:45.4857026+05:30"
},
{
"name": "D",
"reminderTime": "2022-08-27T16:55:50.4857028+05:30"
},
{
"name": "E",
"reminderTime": "2022-08-27T16:55:55.4857029+05:30"
},
{
"name": "F",
"reminderTime": "2022-08-27T16:56:00.485704+05:30"
},
{
"name": "G",
"reminderTime": "2022-08-27T16:56:30.4857042+05:30"
},
{
"name": "H",
"reminderTime": "2022-08-27T16:57:30.4884718+05:30"
}
]
Now if you make POST TaskReminder api call for below request :
{
"name": "Hakuna",
"reminderTime": "2022-08-27T16:57:35"
}
Now if you open console logs of running api project, you will see below logs:
currentTime: 8/27/2022 4:55:35 PM
Added Task:A, time:8/27/2022 4:55:35 PM
tasks added. Total tasks: 1
New tasks:1 found. Adding 1 to queue
----------------------------------------------------------------
currentTime: 8/27/2022 4:55:40 PM
Added Task:B, time:8/27/2022 4:55:40 PM
tasks added. Total tasks: 2
New tasks:1 found. Adding 1 to queue
----------------------------------------------------------------
currentTime: 8/27/2022 4:55:45 PM
Added Task:C, time:8/27/2022 4:55:45 PM
tasks added. Total tasks: 3
New tasks:1 found. Adding 1 to queue
----------------------------------------------------------------
currentTime: 8/27/2022 4:55:50 PM
Added Task:D, time:8/27/2022 4:55:50 PM
tasks added. Total tasks: 4
New tasks:1 found. Adding 1 to queue
----------------------------------------------------------------
currentTime: 8/27/2022 4:55:55 PM
Added Task:E, time:8/27/2022 4:55:55 PM
tasks added. Total tasks: 5
New tasks:1 found. Adding 1 to queue
----------------------------------------------------------------
currentTime: 8/27/2022 4:56:00 PM
Added Task:F, time:8/27/2022 4:56:00 PM
tasks added. Total tasks: 6
New tasks:1 found. Adding 1 to queue
----------------------------------------------------------------
currentTime: 8/27/2022 4:56:30 PM
Added Task:G, time:8/27/2022 4:56:30 PM
tasks added. Total tasks: 7
New tasks:1 found. Adding 1 to queue
----------------------------------------------------------------
currentTime: 8/27/2022 4:57:30 PM
Added Task:H, time:8/27/2022 4:57:30 PM
tasks added. Total tasks: 8
----------------------------------------------------------------
currentTime: 8/27/2022 4:57:35 PM
Added Task:Hakuna, time:8/27/2022 4:57:35 PM
tasks added. Total tasks: 9
which shows that at given reminder time, items are being added to collecton.