Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Commit

Permalink
support find event by time (#2551)
Browse files Browse the repository at this point in the history
  • Loading branch information
KayMKM authored and darrenj committed Oct 21, 2019
1 parent f2ff75c commit 0b70131
Show file tree
Hide file tree
Showing 18 changed files with 101 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,8 @@ private async Task<List<Card>> GetMeetingCardListAsync(CalendarSkillState state,
Name = "CalendarDate",
Data = new CalendarDateCardData()
{
Date = currentAddedDateUser.Value.ToString("dddd, MMMM d").ToUpper()
// format "dddd, MMMM d"
Date = currentAddedDateUser.Value.ToString(CalendarCommonStrings.DisplayDateLong).ToUpper()
}
});
}
Expand Down
14 changes: 10 additions & 4 deletions skills/csharp/calendarskill/Dialogs/ShowEventsDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ public ShowEventsDialog(
SearchEventsWithEntities,
FilterTodayEvent,
AddConflictFlag,
ShowEventsList,
ShowAskParameterDetails,
ShowEventsList
};

var showNextMeeting = new WaterfallStep[]
{
ShowAskParameterDetails,
ShowNextMeeting,
};

Expand Down Expand Up @@ -290,8 +290,9 @@ private bool IsOnlySearchByTime(CalendarSkillState state)
var tokens = new StringDictionary()
{
{ "EventName", state.ShowMeetingInfor.ShowingMeetings[0].Title },
{ "EventStartTime", TimeConverter.ConvertUtcToUserTime(state.ShowMeetingInfor.ShowingMeetings[0].StartTime, state.GetUserTimeZone()).ToString("h:mm tt") },
{ "EventEndTime", TimeConverter.ConvertUtcToUserTime(state.ShowMeetingInfor.ShowingMeetings[0].EndTime, state.GetUserTimeZone()).ToString("h:mm tt") },
{ "EventStartDate", TimeConverter.ConvertUtcToUserTime(state.ShowMeetingInfor.ShowingMeetings[0].StartTime, state.GetUserTimeZone()).ToString(CalendarCommonStrings.DisplayDateLong) },
{ "EventStartTime", TimeConverter.ConvertUtcToUserTime(state.ShowMeetingInfor.ShowingMeetings[0].StartTime, state.GetUserTimeZone()).ToString(CommonStrings.DisplayTime) },
{ "EventEndTime", TimeConverter.ConvertUtcToUserTime(state.ShowMeetingInfor.ShowingMeetings[0].EndTime, state.GetUserTimeZone()).ToString(CommonStrings.DisplayTime) },
{ "EventDuration", state.ShowMeetingInfor.ShowingMeetings[0].ToSpeechDurationString() },
{ "EventLocation", state.ShowMeetingInfor.ShowingMeetings[0].Location },
};
Expand Down Expand Up @@ -320,6 +321,11 @@ private bool IsOnlySearchByTime(CalendarSkillState state)
await sc.Context.SendActivityAsync(ResponseManager.GetResponse(SummaryResponses.ReadLocation, tokens));
}
}

if (askParameter.NeedDate)
{
await sc.Context.SendActivityAsync(ResponseManager.GetResponse(SummaryResponses.ReadStartDate, tokens));
}
}
}

Expand Down
14 changes: 14 additions & 0 deletions skills/csharp/calendarskill/Models/AskParameterModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public enum AskParameterType
/// ask for content
/// </summary>
AskForContent = 8,

/// <summary>
/// ask for date
/// </summary>
AskForDate = 9,
}

public class AskParameterModel
Expand Down Expand Up @@ -110,6 +115,13 @@ public AskParameterModel(string content)
break;
}

case AskParameterType.AskForDate:
{
NeedDate = true;
NeedDetail = true;
break;
}

default:
{
break;
Expand All @@ -128,5 +140,7 @@ public AskParameterModel(string content)
public bool NeedDuration { get; set; } = false;

public bool NeedLocation { get; set; } = false;

public bool NeedDate { get; set; } = false;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,10 @@
<data name="ShowEventTitleCondition" xml:space="preserve">
<value>ungefähr {0}</value>
</data>
<data name="AskForDate" xml:space="preserve">
<value>was (Tag|Datum)</value>
</data>
<data name="DisplayDateLong" xml:space="preserve">
<value>dddd, MMMM d</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,10 @@
<data name="ShowEventTitleCondition" xml:space="preserve">
<value>acerca de {0}</value>
</data>
<data name="AskForDate" xml:space="preserve">
<value>qué (día|fecha)</value>
</data>
<data name="DisplayDateLong" xml:space="preserve">
<value>dddd, MMMM d</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,10 @@
<data name="ShowEventTitleCondition" xml:space="preserve">
<value>à propos de {0}</value>
</data>
<data name="AskForDate" xml:space="preserve">
<value>quoi (jour|date)</value>
</data>
<data name="DisplayDateLong" xml:space="preserve">
<value>dddd, MMMM d</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,10 @@
<data name="ShowEventTitleCondition" xml:space="preserve">
<value>circa {0}</value>
</data>
<data name="AskForDate" xml:space="preserve">
<value>ciò (giorno|data)</value>
</data>
<data name="DisplayDateLong" xml:space="preserve">
<value>dddd, MMMM d</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,10 @@
<data name="ShowEventTitleCondition" xml:space="preserve">
<value>about {0}</value>
</data>
<data name="AskForDate" xml:space="preserve">
<value>what (day|date)</value>
</data>
<data name="DisplayDateLong" xml:space="preserve">
<value>dddd, MMMM d</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,10 @@
<data name="ShowEventTitleCondition" xml:space="preserve">
<value>关于{0}</value>
</data>
<data name="AskForDate" xml:space="preserve">
<value>几号|什么日期|星期几|礼拜几</value>
</data>
<data name="DisplayDateLong" xml:space="preserve">
<value>MMMM d,dddd</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class SummaryResponses : IResponseIdCollection
public const string ReadDuration = "ReadDuration";
public const string ReadLocation = "ReadLocation";
public const string ReadNoLocation = "ReadNoLocation";
public const string ReadStartDate = "ReadStartDate";
public const string AskForChangeStatus = "AskForChangeStatus";
public const string AskForAction = "AskForAction";
public const string AskForOrgnizerAction = "AskForOrgnizerAction";
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,15 @@
],
"inputHint": "acceptingInput"
},
"ReadStartDate": {
"replies": [
{
"text": "It starts on {EventStartDate}.",
"speak": "It starts on {EventStartDate}."
}
],
"inputHint": "acceptingInput"
},
"AskForChangeStatus": {
"replies": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,14 @@
}
],
"inputHint": "acceptingInput"
},
"ReadStartDate": {
"replies": [
{
"text": "这个会议在{EventStartDate}开始。",
"speak": "这个会议在{EventStartDate}开始。"
}
],
"inputHint": "acceptingInput"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ static AskParameterTemplate()
{ AskParameterType.AskForLocation, CalendarCommonStrings.AskForLocation },
{ AskParameterType.AskForAttendee, CalendarCommonStrings.AskForAttendee },
{ AskParameterType.AskForTitle, CalendarCommonStrings.AskForTitle },
{ AskParameterType.AskForContent, CalendarCommonStrings.AskForContent }
{ AskParameterType.AskForContent, CalendarCommonStrings.AskForContent },
{ AskParameterType.AskForDate, CalendarCommonStrings.AskForDate }
};
}

Expand Down

0 comments on commit 0b70131

Please sign in to comment.