Skip to content

Commit

Permalink
Merge pull request #614 from SSWConsulting/603_enhance_profile_card
Browse files Browse the repository at this point in the history
Add device name in last seen field
  • Loading branch information
AttackOnMorty authored Aug 31, 2023
2 parents e51b0af + 99ce4c4 commit 9ac9bc9
Show file tree
Hide file tree
Showing 4 changed files with 485 additions and 462 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ private EmployeeProfileWithStatusModel ConvertToProfile(GetEmployeeModel employe
BookingStatus = EmployeesHelper.GetBookingStatus(employee, date),
LastSeenAt = employee.LastSeenAt,
LastSeenTime = EmployeesHelper.GetLastSeen(employee),
LastSeenPhoneDevice = EmployeesHelper.GetLastSeenPhoneDevice(employee),
Skills = employee.Skills,
EmailAddress = employee.EmailAddress,
MobilePhone = employee.MobilePhone,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,19 @@ static int GetInteger(double value)
}
}

public static string GetLastSeenPhoneDevice(GetEmployeeModel employee)
{
if (employee.LastSeenAt == null || employee.LastSeenAt.MacAddress == null || employee.Devices == null)
{
return null;
}

List<GetDeviceModel> phoneDevices = employee.Devices.Where(device => device.DeviceType == "Phone").ToList();
GetDeviceModel device = phoneDevices.FirstOrDefault(device => device.MacAddress.Equals(employee.LastSeenAt.MacAddress, StringComparison.OrdinalIgnoreCase));

return device?.DeviceName;
}

public static NextClientModel GetNextUnavailability(GetEmployeeModel employee, DateTime date, out int freeDays, bool startFromNextWeek = true)
{
freeDays = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public class EmployeeProfileWithStatusModel
[JsonProperty("lastSeenTime")]
public string LastSeenTime { get; set; }

[JsonProperty("lastSeenPhoneDevice")]
public string LastSeenPhoneDevice { get; set; }

[JsonProperty("skills")]
public List<GetSkillModel> Skills { get; set; }

Expand Down
Loading

0 comments on commit 9ac9bc9

Please sign in to comment.