Skip to content

Commit

Permalink
Merge pull request #795 from SanDiegoCountySheriff/task/fix-templates
Browse files Browse the repository at this point in the history
fix: revert GetTemplates method
  • Loading branch information
jacobkellas authored Jan 12, 2024
2 parents 58a8d61 + 9d4cc9c commit a61f2f1
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,18 @@ public async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "

List<Template> response = new List<Template>();

try
{
var queryResult = _tableClient.Query<Template>();
var queryResult = _tableClient.Query<Template>();

response.AddRange(queryResult.Where(t => t.DeactivationDate <= DateTime.Now));

response.OrderBy(t => t.Id);
}
catch (Exception ex)
foreach (var template in queryResult)
{
return new NotFoundObjectResult(ex.Message);
if (template?.DeactivationDate <= DateTime.Now)
{
continue;
}
response.Add(template);
}

response.OrderBy(t => t.Id);

log.LogInformation($"GetTemplates returned {response.Count} templates");
return new OkObjectResult(response);
Expand Down

0 comments on commit a61f2f1

Please sign in to comment.