Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Core/Resgrid.Chatbot.NLU/Providers/KeywordIntentClassifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ public class KeywordIntentClassifier : INLUProvider
// Call number form ("26-1" / "C26-1"): two-digit year + sequence — resolved by the handler.
(R(@"^c?(\d{2,4}-\d+)$"), "call_detail", m => P("callRef", m.Groups[1].Value)),
(R(@"^units?$"), "list_units", null),
(R(@"^(my\s+)?status$"), "my_status", null),
// "my staffing" — the my_status handler reports both status and staffing.
(R(@"^(my\s+)?staffing$"), "my_status", null),
(R(@"^(my\s+)?(current\s+)?status$"), "my_status", null),
// Staffing queries use the my_status handler because it reports both status and staffing.
(R(@"^(my\s+)?(current\s+)?staffing$"), "my_status", null),
(R(@"^(messages?|msgs?)$"), "list_messages", null),
// Unread/new message forms route to the same list handler (it lists unread only).
(R(@"^(any\s+|my\s+)?(unread|new)\s+(messages?|msgs?)$"), "list_messages", null),
Expand Down
15 changes: 1 addition & 14 deletions Providers/Resgrid.Providers.Cache/AzureRedisCacheProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,7 @@ public async Task<long> IncrementAsync(string cacheKey, TimeSpan expiration)

public bool IsConnected()
{
EstablishRedisConnection();

return _connection.IsConnected;
return _connection?.IsConnected ?? false;
}

private string SetCacheKeyForEnv(string cacheKey)
Expand All @@ -294,17 +292,6 @@ private void EstablishRedisConnection()
{
int retry = 0;

try
{
if (_connection != null && _connection.IsConnected == false)
{
_connection.Close();
_connection = null;
}

}
catch { }

while (_connection == null && retry <= 3)
{
retry++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ public async Task Classifies_intent(string text, string expectedIntent)
result.IntentName.Should().Be(expectedIntent, because: $"\"{text}\" should classify as {expectedIntent}");
}

[TestCase("Current status")]
[TestCase("Current staffing")]
[TestCase("my current status")]
[TestCase("my current staffing")]
public async Task Current_status_queries_are_exact_matches(string text)
{
// Arrange

// Act
var result = await _classifier.ClassifyAsync(text);

// Assert
result.IntentName.Should().Be("my_status");
result.Confidence.Should().Be(1.0, because: "the intent router rejects the 0.60 fuzzy fallback");
}

[Test]
public async Task WhoIsOnCall_extracts_call_reference()
{
Expand Down
2 changes: 1 addition & 1 deletion Web/Resgrid.Web/Controllers/HealthController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public async Task<IActionResult> GetCurrent()
result.WebsiteVersion = Assembly.GetEntryAssembly().GetName().Version.ToString();
result.SiteId = "0";
result.CacheOnline = _healthService.IsCacheProviderConnected();
result.ServiceBusOnline = _healthService.IsCacheProviderConnected();
result.ServiceBusOnline = await _healthService.IsServiceBusProviderConnected();

var dbTime = await _healthService.GetDatabaseTimestamp();

Expand Down
6 changes: 3 additions & 3 deletions Web/Resgrid.Web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,9 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF

app.UseAuthentication();
app.UseAuthorization();

app.UseSession();

app.UseWhen(
context => !string.Equals(context.Request.Path.Value, "/health/getcurrent", StringComparison.OrdinalIgnoreCase),
authenticatedApp => authenticatedApp.UseSession());
app.UseMiddleware<Resgrid.Web.Middleware.Require2FAEnrollmentMiddleware>();

app.UseRequestLocalization();
Expand Down
Loading