Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug with Text Customer Property #21

Merged
merged 1 commit into from
Jun 10, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/build-visitor-groups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:
workflow_dispatch:

env:
BUILD_NO: 2.0.1.${{ github.run_number }}
BUILD_NO_PRE: 2.0.1-rc.${{ github.run_number }}
BUILD_NO: 2.0.2.${{ github.run_number }}
BUILD_NO_PRE: 2.0.2-rc.${{ github.run_number }}

jobs:
build:
Expand Down
11 changes: 11 additions & 0 deletions src/DemoSite/Views/Shared/Layouts/_Root.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@

// Edits to this script should only be made below this line.
zaius.event('pageview');

zaius.customer({ // First object contains any known customer identifiers
email: "johnny.zaius@zaius.com"
},{ // Second object contains customer attributes
first_name: "Johnny",
last_name: "Zaius",
gender: "M",
dob_year: 1980,
dob_month: 1,
dob_day: 1
});
</script>

@if (Model.Layout.IsInReadonlyMode)
Expand Down
1 change: 1 addition & 0 deletions src/DemoSite/nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="optimizely" value="https://nuget.optimizely.com/feed/packages.svc" />
<add key="github" value="https://nuget.pkg.github.com/unrvld/index.json" />
</packageSources>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ protected override bool IsMatchInner(IPrincipal principal, string vuidValue)
return false;
}

if (!customer.AdditionalFields.TryGetValue(Model.PropertyName, out var propertyToken))
if (!customer.AdditionalFields.TryGetValue(splitPrefix.value, out var propertyToken))
{
return false;
}

var propertyValue = propertyToken?.Value<string>();
var propertyValue = propertyToken?.Value<string>()?.Trim();

switch (Model.Comparison)
{
Expand All @@ -55,32 +55,32 @@ protected override bool IsMatchInner(IPrincipal principal, string vuidValue)
case "Is":
if (propertyValue != null)
{
return propertyValue.Equals(Model.PropertyValue, StringComparison.CurrentCultureIgnoreCase);
return propertyValue.Equals(Model.PropertyValue.Trim(), StringComparison.CurrentCultureIgnoreCase);
}

break;
case "StartsWith":
if (propertyValue != null)
{
return propertyValue.StartsWith(Model.PropertyValue, StringComparison.CurrentCultureIgnoreCase);
return propertyValue.StartsWith(Model.PropertyValue.Trim(), StringComparison.CurrentCultureIgnoreCase);
}

break;
case "Contains":
if (propertyValue != null)
{
#if NET5_0_OR_GREATER
return propertyValue.Contains(Model.PropertyValue, StringComparison.CurrentCultureIgnoreCase);
return propertyValue.Contains(Model.PropertyValue.Trim(), StringComparison.CurrentCultureIgnoreCase);
#else
return propertyValue.IndexOf(Model.PropertyValue, StringComparison.CurrentCultureIgnoreCase) >= 0;
return propertyValue.IndexOf(Model.PropertyValue?.Trim(), StringComparison.CurrentCultureIgnoreCase) >= 0;
#endif
}

break;
case "EndsWith":
if (propertyValue != null)
{
return propertyValue.EndsWith(Model.PropertyValue, StringComparison.CurrentCultureIgnoreCase);
return propertyValue.EndsWith(Model.PropertyValue.Trim(), StringComparison.CurrentCultureIgnoreCase);
}

break;
Expand Down
3 changes: 2 additions & 1 deletion src/UNRVLD.ODP.VisitorGroups/UNRVLD.ODP.VisitorGroups.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<PackageId>UNRVLD.ODP.VisitorGroups</PackageId>
<RepositoryUrl>/~https://github.com/made-to-engage/ODP.VisitorGroups</RepositoryUrl>
<Version>2.0.1</Version>
<Version>2.0.2</Version>
<Authors>Andrew Markham; David Knipe</Authors>
<Owners>Made to Engage;UNRVLD</Owners>
<Title>UNRVLD - Optimizely Visitor Groups</Title>
Expand All @@ -22,6 +22,7 @@
2.0.0 - Removed support for CMS 11
- Added support for multiple ODP instances
- Added support for .net8
2.0.2 - Fixed issue with Customer Property Text criteria not working
</ReleaseNotes>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
Expand Down