Skip to content

Commit

Permalink
Filter out duplicate rules (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrookJeynes authored Mar 4, 2024
1 parent bdbf958 commit eea576d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion SSW.Rules.AzFuncs/Domain/LatestRules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public class LatestRules : BaseEntity
public string CreatedBy { get; set; }
public string UpdatedBy { get; set; }
public string GitHubUsername { get; set; }
}
}
3 changes: 2 additions & 1 deletion SSW.Rules.AzFuncs/Functions/Widget/GetLatestRules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public async Task<HttpResponseData> Run(
r.CreatedBy == githubUsername || r.UpdatedBy == githubUsername)
.GroupBy(r => r.RuleGuid)
.Select(group => group.First())
.DistinctBy(r => r.RuleGuid)
.OrderByDescending(r => r.UpdatedAt)
.Skip(skip)
.Take(take);
Expand All @@ -40,4 +41,4 @@ public async Task<HttpResponseData> Run(
? req.CreateJsonErrorResponse(HttpStatusCode.NotFound, "Not Found")
: req.CreateJsonResponse(filteredRules);
}
}
}

0 comments on commit eea576d

Please sign in to comment.