Skip to content

Commit

Permalink
Opporunity title now strips special characters and ensure ordering by…
Browse files Browse the repository at this point in the history
… title (#1112)
  • Loading branch information
adrianwium authored Sep 23, 2024
1 parent 9ca9e70 commit 3c1e928
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ await _executionStrategyService.ExecuteInExecutionStrategyAsync(async () =>
scope.Complete();
});

if (result.Opportunities?.Count == 0) result.Opportunities = null;
result.Opportunities = result.Opportunities?.OrderBy(o => o.Title).ToList();

_memoryCache.Remove(CacheHelper.GenerateKey<StoreAccessControlRule>());

return result;
Expand Down Expand Up @@ -405,6 +408,7 @@ await _executionStrategyService.ExecuteInExecutionStrategyAsync(async () =>
});

if (result.Opportunities?.Count == 0) result.Opportunities = null;
result.Opportunities = result.Opportunities?.OrderBy(o => o.Title).ToList();

_memoryCache.Remove(CacheHelper.GenerateKey<StoreAccessControlRule>());

Expand Down Expand Up @@ -721,7 +725,7 @@ private void ValidateRuleDuplicatesAcrossOrganizations(StoreAccessControlRuleReq
var opportunityMessage = duplicateRule.OpportunityOption == StoreAccessControlRuleOpportunityCondition.All
? "Must complete the following opportunities:" : "Must complete at least one of the following opportunities:";

var opportunityTitles = string.Join(", ", duplicateRule.Opportunities.Select(o => o.Title));
var opportunityTitles = string.Join(", ", duplicateRule.Opportunities.Select(o => o.Title.RemoveSpecialCharacters()));
reasons.Add($"{opportunityMessage} {opportunityTitles}.");
}

Expand Down

0 comments on commit 3c1e928

Please sign in to comment.