diff --git a/.github/workflows/SSW.SophieBot.test.yml b/.github/workflows/SSW.SophieBot.test.yml deleted file mode 100644 index 35684348..00000000 --- a/.github/workflows/SSW.SophieBot.test.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Build and Test - -on: - pull_request: - paths-ignore: - - '_docs/**' - push: - branches: - - main - paths: - - 'bots/**' - - 'libraries/**' - - 'services/**' - - .github/workflows/SSW.SophieBot.test.yml - -concurrency: - group: SSWSophieBot-BuildAndTest - cancel-in-progress: true - -defaults: - run: - shell: pwsh - -jobs: - build-test: - name: Build and test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2.3.4 - - - name: Use .Net sdk 6.0.x - uses: actions/setup-dotnet@v1.9.0 - with: - dotnet-version: '6.0.x' - - - name: Build all - run: .\build-all.ps1 - working-directory: ./_scripts - - - name: Test all - run: .\test-all.ps1 - working-directory: ./_scripts - - - name: Codecov - uses: codecov/codecov-action@v2.1.0 diff --git a/bots/employee-finder/src/SSW.SophieBot.HttpClientComponents.PersonQuery/Actions/GetProfileWithStatusAction.cs b/bots/employee-finder/src/SSW.SophieBot.HttpClientComponents.PersonQuery/Actions/GetProfileWithStatusAction.cs index 8a6548fc..e3c7166e 100644 --- a/bots/employee-finder/src/SSW.SophieBot.HttpClientComponents.PersonQuery/Actions/GetProfileWithStatusAction.cs +++ b/bots/employee-finder/src/SSW.SophieBot.HttpClientComponents.PersonQuery/Actions/GetProfileWithStatusAction.cs @@ -7,6 +7,7 @@ using SSW.SophieBot.HttpClientComponents.PersonQuery.Models; using System; using System.Linq; +using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; @@ -68,16 +69,7 @@ private EmployeeProfileWithStatusModel ConvertToProfile(GetEmployeeModel employe LastName = employee.LastName, BillableRate = employee.BillableRate, BookedDays = EmployeesHelper.GetBookedDays(employee, date), - Appointments = EmployeesHelper.GetAppointments(employee.NormalizedAppointments, date, 10) - .Select(a => new EmployeeProfileAppointment - { - Start = a.Start.DateTime.ToUserFriendlyDate(date), - Duration = (a.End - a.Start).ToUserFriendlyDuration(), - BookingStatus = EmployeesHelper.GetBookingStatus(a), - Subject = a.Subject.Trim(), - Regarding = a.Regarding.Trim() - }) - .ToList() + Appointments = GetDisplayAppointments(EmployeesHelper.GetAppointments(employee.NormalizedAppointments, date, 10), date) }; if (profile.BookingStatus == BookingStatus.Leave) @@ -99,5 +91,40 @@ private EmployeeProfileWithStatusModel ConvertToProfile(GetEmployeeModel employe return profile; } + + private List GetDisplayAppointments(IEnumerable sourceAppointments, DateTime date) + { + var result = new List(); + var appointment = new EmployeeProfileAppointment(); + if (!sourceAppointments.Any()) + { + return result; + } + + foreach (var sourceAppointment in sourceAppointments.OrderBy(sa => sa.Start.DateTime)) + { + if (appointment.Subject != sourceAppointment.Subject) + { + appointment = new EmployeeProfileAppointment + { + Start = sourceAppointment.Start.DateTime.ToUserFriendlyDate(date), + End = sourceAppointment.End.DateTime.ToUserFriendlyDate(date), + Duration = (sourceAppointment.End - sourceAppointment.Start).ToUserFriendlyDuration(), + BookingStatus = EmployeesHelper.GetBookingStatus(sourceAppointment), + Subject = sourceAppointment.Subject.Trim(), + Regarding = sourceAppointment.Regarding.Trim() + }; + + result.Add(appointment); + } + else + { + appointment.End = sourceAppointment.End.DateTime.ToUserFriendlyDate(date); + appointment.Duration = (sourceAppointment.End - sourceAppointment.Start).ToUserFriendlyDuration(); + } + } + + return result; + } } } diff --git a/bots/employee-finder/src/SSW.SophieBot.HttpClientComponents.PersonQuery/Models/EmployeeProfileModel.cs b/bots/employee-finder/src/SSW.SophieBot.HttpClientComponents.PersonQuery/Models/EmployeeProfileModel.cs index aa0d1d39..90e957d1 100644 --- a/bots/employee-finder/src/SSW.SophieBot.HttpClientComponents.PersonQuery/Models/EmployeeProfileModel.cs +++ b/bots/employee-finder/src/SSW.SophieBot.HttpClientComponents.PersonQuery/Models/EmployeeProfileModel.cs @@ -65,6 +65,9 @@ public class EmployeeProfileAppointment { [JsonProperty("start")] public string Start { get; set; } + + [JsonProperty("end")] + public string End { get; set; } [JsonProperty("duration")] public string Duration { get; set; } diff --git a/bots/employee-finder/src/SSW.SophieBot/language-generation/en-us/agenda.en-us.lg b/bots/employee-finder/src/SSW.SophieBot/language-generation/en-us/agenda.en-us.lg index 215c4f78..7d102b14 100644 --- a/bots/employee-finder/src/SSW.SophieBot/language-generation/en-us/agenda.en-us.lg +++ b/bots/employee-finder/src/SSW.SophieBot/language-generation/en-us/agenda.en-us.lg @@ -65,7 +65,20 @@ "items": [ { "type": "TextBlock", - "text": "Date", + "text": "Start", + "wrap": true, + "weight": "Bolder" + } + ], + "verticalContentAlignment": "Center" + }, + { + "type": "Column", + "width": "stretch", + "items": [ + { + "type": "TextBlock", + "text": "End", "wrap": true, "weight": "Bolder" } @@ -128,6 +141,19 @@ ], "verticalContentAlignment": "Center" }, + { + "type": "Column", + "width": "stretch", + "items": [ + { + "type": "TextBlock", + "text": "${appointment.end}", + "wrap": true, + "size": "${ContentTextSize()}" + } + ], + "verticalContentAlignment": "Center" + }, { "type": "Column", "width": "stretch",