Skip to content

Commit 2b74ff9

Browse files
Exclude internal hours from billed days (#751)
1 parent 628d430 commit 2b74ff9

2 files changed

Lines changed: 40 additions & 24 deletions

File tree

bots/employee-finder/src/SSW.SophieBot.HttpClientComponents.PersonQuery/Actions/GetFreeEmployeesAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public override async Task<DialogTurnResult> BeginDialogAsync(DialogContext dc,
5151
{
5252
employee.NormalizeAppointments(dc);
5353
var nextUnavailability = EmployeesHelper.GetNextUnavailability(employee, date, out var freeDays);
54-
int billableDays = EmployeesHelper.GetTotalBilledDays(employee.Projects, out var billableHours);
54+
int billableDays = EmployeesHelper.GetBilledDays(employee, employee.Projects.FirstOrDefault(), out var billableHours);
5555
return new FreeEmployeeModel
5656
{
5757
FirstName = employee.FirstName,

bots/employee-finder/src/SSW.SophieBot.HttpClientComponents.PersonQuery/EmployeesHelper.cs

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static List<EmployeeBillableItemModel> GetBillableEmployees(
5252
foreach (var employeeProject in employeeProjects)
5353
{
5454
double billableHours = employeeProject.BillableHours;
55-
int billedDays = GetBilledDays(billableHours);
55+
int billedDays = GetBilledDays(e, employeeProject, out billableHours);
5656
billedProjects.Add(new BilledProject
5757
{
5858
BilledDays = billedDays,
@@ -174,28 +174,44 @@ public static BookingStatus GetBookingStatus(GetEmployeeModel employee, DateTime
174174
return BookingStatus.Unknown;
175175
}
176176

177-
public static int GetBilledDays(double billableHours)
178-
{
179-
const int HOURS_PER_DAY = 8;
180-
181-
return (int)Math.Ceiling(billableHours / HOURS_PER_DAY);
182-
}
183-
184-
public static int GetTotalBilledDays(List<GetEmployeeProjectModel> Projects, out double billableHours)
185-
{
186-
billableHours = 0;
187-
188-
if (Projects == null || !Projects.Any())
189-
{
190-
return 0;
191-
}
192-
193-
foreach (var project in Projects)
194-
{
195-
billableHours += project.BillableHours;
196-
}
197-
198-
return GetBilledDays(billableHours);
177+
// public static int GetBilledDays(double billableHours)
178+
// {
179+
// const int HOURS_PER_DAY = 8;
180+
//
181+
// return (int)Math.Ceiling(billableHours / HOURS_PER_DAY);
182+
// }
183+
//
184+
// public static int GetTotalBilledDays(List<GetEmployeeProjectModel> Projects, out double billableHours)
185+
// {
186+
// billableHours = 0;
187+
//
188+
// if (Projects == null || !Projects.Any())
189+
// {
190+
// return 0;
191+
// }
192+
//
193+
// foreach (var project in Projects)
194+
// {
195+
// billableHours += project.BillableHours;
196+
// }
197+
//
198+
// return GetBilledDays(billableHours);
199+
// }
200+
201+
public static int GetBilledDays(GetEmployeeModel employee, GetEmployeeProjectModel project, out double billableHours)
202+
{
203+
204+
205+
if (project != null && project.CustomerName != "SSW")
206+
{
207+
billableHours = project?.BillableHours ?? 0;
208+
}
209+
else {
210+
billableHours = 0;
211+
}
212+
213+
214+
return billableHours == 0 ? 0 : (int)Math.Ceiling(billableHours / 8);
199215
}
200216

201217
public static int GetBookedDays(GetEmployeeModel employee, DateTime startDate)

0 commit comments

Comments
 (0)