I have some personalization conditions. None of these seem to execute. When debugging, none of the rules stop with break points. I have tried using the most simple built in rules such as when [date] has passed
to no avail. It is just not stepping through the conditions.
This is on Sitecore.NET 8.2 (rev. 160729)
I have values Xdb.Enabled
and Xdb.Tracking.Enabled
set to true
.
I am testing in normal mode. I have Sitecore.xDB.base
license.
I see nothing in logs.
Below are the control properties and personalization rules. If the control does not have a data source nothing shows.
I have seen all of the custom rules execute correctly. This is the only rule that I have not seen execute correctly. Possibly if there is one rule that is incorrect it would stop personalization running altogether?
public class AptifyMemberDuesPaidThruCondition<T> : OperatorCondition<T> where T : RuleContext
{
private readonly IAptifyAuthenticator _aptifyAuthenticator;
public AptifyMemberDuesPaidThruCondition() : this(ServiceLocator.ServiceProvider.GetService<IAptifyAuthenticator>())
{ }
public AptifyMemberDuesPaidThruCondition(IAptifyAuthenticator aptifyAuthenticator)
{
_aptifyAuthenticator = aptifyAuthenticator;
}
public string DuesPaidThru { get; set; }
/// <summary>
/// This function will be called to test the condition
/// </summary>
protected override bool Execute(T ruleContext)
{
//Check if the user is logged in, otherwise return false
if (!_aptifyAuthenticator.UserAptifyAuthenticated())
return false;
DateTime dateTime = DateUtil.ParseDateTime(this.DuesPaidThru, DateTime.MinValue);
if (dateTime.Kind != DateTimeKind.Utc)
{
string str = string.Concat("AptifyMemberDuesPaidThruCondition<T> expects UTC date, but date with different kind has been assigned to Now property: ", this.DuesPaidThru);
Log.Warn(str, this);
}
var actualDuesPaidThru = _aptifyAuthenticator.GetUserCustomerPropertyDate(AuthenticatedPropertyName.DuesPaidThru);
if (!actualDuesPaidThru.HasValue)
return false;
return DateComparer(actualDuesPaidThru.Value, dateTime, GetOperator());
}
private bool DateComparer(DateTime date1, DateTime date2, ConditionOperator conditionOperator)
{
switch (conditionOperator)
{
case ConditionOperator.Equal:
return date1.Equals(date2);
case ConditionOperator.LessThan:
return date1 < date2;
case ConditionOperator.LessThanOrEqual:
return date1 <= date2;
case ConditionOperator.GreaterThan:
return date1 > date2;
case ConditionOperator.GreaterThanOrEqual:
return date1 >= date2;
case ConditionOperator.NotEqual:
return !date1.Equals(date2);
default:
return false;
}
}
}
Any ideas where to troubleshoot?
Update: this started working after I went to web database, modified a property (not related to personalization) and saved the item. This indicates some other kind of issue.
Update 2: it stopped working with no changes. I can change the item and see changes, but personalization is now not working. It is like it just turns off.