Add calendar service-down support to personal report
This commit is contained in:
@@ -35,6 +35,7 @@ public sealed class JiboExperienceCatalog
|
||||
public IReadOnlyList<string> WeatherServiceDownReplies { get; init; } = [];
|
||||
public IReadOnlyList<string> CalendarNothingTodayReplies { get; init; } = [];
|
||||
public IReadOnlyList<string> CalendarNothingReplies { get; init; } = [];
|
||||
public IReadOnlyList<string> CalendarServiceDownReplies { get; init; } = [];
|
||||
public IReadOnlyList<string> CalendarOutroReplies { get; init; } = [];
|
||||
public IReadOnlyList<string> CommuteNowReplies { get; init; } = [];
|
||||
public IReadOnlyList<string> CommuteServiceDownReplies { get; init; } = [];
|
||||
|
||||
@@ -272,12 +272,23 @@ internal static class PersonalReportOrchestrator
|
||||
|
||||
if (toggles.CalendarEnabled)
|
||||
{
|
||||
var calendarSummary = ChooseReportSkillTemplate(
|
||||
catalog.CalendarNothingTodayReplies,
|
||||
catalog.CalendarNothingReplies,
|
||||
string.Empty);
|
||||
if (string.IsNullOrWhiteSpace(calendarSummary))
|
||||
calendarSummary = ChooseReportSkillTemplate(
|
||||
catalog.CalendarServiceDownReplies,
|
||||
[],
|
||||
"Looking at your calendar, I don't see anything scheduled today.");
|
||||
|
||||
reportSections.Add(RenderReportSkillTemplate(calendarSummary, userName));
|
||||
reportSections.Add(
|
||||
RenderReportSkillTemplate(
|
||||
ChooseReportSkillTemplate(
|
||||
catalog.CalendarNothingTodayReplies,
|
||||
catalog.CalendarNothingReplies,
|
||||
"Looking at your calendar, I don't see anything scheduled today."),
|
||||
catalog.CalendarOutroReplies,
|
||||
[],
|
||||
"And that's your calendar."),
|
||||
userName));
|
||||
}
|
||||
|
||||
|
||||
@@ -134,6 +134,9 @@ public static class LegacyMimCatalogImporter
|
||||
if (fileName.StartsWith("CalendarNothing", StringComparison.OrdinalIgnoreCase))
|
||||
return LegacyMimBucket.CalendarNothing;
|
||||
|
||||
if (fileName.StartsWith("CalendarServiceDown", StringComparison.OrdinalIgnoreCase))
|
||||
return LegacyMimBucket.CalendarServiceDown;
|
||||
|
||||
if (fileName.StartsWith("CalendarOutro", StringComparison.OrdinalIgnoreCase))
|
||||
return LegacyMimBucket.CalendarOutro;
|
||||
|
||||
@@ -251,6 +254,8 @@ public static class LegacyMimCatalogImporter
|
||||
CalendarNothingTodayReplies = Merge(baseCatalog.CalendarNothingTodayReplies,
|
||||
importedCatalog.CalendarNothingTodayReplies),
|
||||
CalendarNothingReplies = Merge(baseCatalog.CalendarNothingReplies, importedCatalog.CalendarNothingReplies),
|
||||
CalendarServiceDownReplies = Merge(baseCatalog.CalendarServiceDownReplies,
|
||||
importedCatalog.CalendarServiceDownReplies),
|
||||
CalendarOutroReplies = Merge(baseCatalog.CalendarOutroReplies, importedCatalog.CalendarOutroReplies),
|
||||
CommuteNowReplies = Merge(baseCatalog.CommuteNowReplies, importedCatalog.CommuteNowReplies),
|
||||
CommuteServiceDownReplies = Merge(baseCatalog.CommuteServiceDownReplies,
|
||||
@@ -352,6 +357,7 @@ public static class LegacyMimCatalogImporter
|
||||
WeatherServiceDown,
|
||||
CalendarNothingToday,
|
||||
CalendarNothing,
|
||||
CalendarServiceDown,
|
||||
CalendarOutro,
|
||||
CommuteNow,
|
||||
CommuteServiceDown,
|
||||
@@ -365,6 +371,7 @@ public static class LegacyMimCatalogImporter
|
||||
{
|
||||
private readonly List<string> _calendarNothingReplies = [];
|
||||
private readonly List<string> _calendarNothingTodayReplies = [];
|
||||
private readonly List<string> _calendarServiceDownReplies = [];
|
||||
private readonly List<string> _calendarOutroReplies = [];
|
||||
private readonly List<string> _commuteNowReplies = [];
|
||||
private readonly List<string> _commuteServiceDownReplies = [];
|
||||
@@ -485,6 +492,9 @@ public static class LegacyMimCatalogImporter
|
||||
case LegacyMimBucket.CalendarNothing:
|
||||
AddDistinct(_calendarNothingReplies, text);
|
||||
return;
|
||||
case LegacyMimBucket.CalendarServiceDown:
|
||||
AddDistinct(_calendarServiceDownReplies, text);
|
||||
return;
|
||||
case LegacyMimBucket.CalendarOutro:
|
||||
AddDistinct(_calendarOutroReplies, text);
|
||||
return;
|
||||
@@ -534,6 +544,7 @@ public static class LegacyMimCatalogImporter
|
||||
WeatherServiceDownReplies = [.. _weatherServiceDownReplies],
|
||||
CalendarNothingTodayReplies = [.. _calendarNothingTodayReplies],
|
||||
CalendarNothingReplies = [.. _calendarNothingReplies],
|
||||
CalendarServiceDownReplies = [.. _calendarServiceDownReplies],
|
||||
CalendarOutroReplies = [.. _calendarOutroReplies],
|
||||
CommuteNowReplies = [.. _commuteNowReplies],
|
||||
CommuteServiceDownReplies = [.. _commuteServiceDownReplies],
|
||||
|
||||
@@ -265,6 +265,8 @@ public sealed class LegacyMimCatalogImporterTests
|
||||
catalog.PersonalReportOutroReplies);
|
||||
Assert.Contains("Looking at your calendar, I don't see anything scheduled today.",
|
||||
catalog.CalendarNothingTodayReplies);
|
||||
Assert.Contains("Looks like I can't access calendars right now. Sorry.", catalog.CalendarServiceDownReplies);
|
||||
Assert.Contains("And that's your calendar.", catalog.CalendarOutroReplies);
|
||||
Assert.Contains("Sorry, commute information isn't available right now.", catalog.CommuteServiceDownReplies);
|
||||
Assert.Contains("Here's today's news, from the associated press.", catalog.NewsIntroReplies);
|
||||
Assert.Contains("And that's what's new in the news.", catalog.NewsOutroReplies);
|
||||
@@ -316,6 +318,7 @@ public sealed class LegacyMimCatalogImporterTests
|
||||
Assert.Contains("Today's high is {high}, and the low is {low}.", catalog.WeatherTodayHighLowReplies);
|
||||
Assert.Contains("Looking at your calendar, I don't see anything scheduled today.",
|
||||
catalog.CalendarNothingTodayReplies);
|
||||
Assert.Contains("Looks like I can't access calendars right now. Sorry.", catalog.CalendarServiceDownReplies);
|
||||
}
|
||||
|
||||
private static string CreateSeedDirectory()
|
||||
|
||||
Reference in New Issue
Block a user