Closed chenmark1 closed 4 years ago
Hello @chenmark1 ,
Could you give the full code including the query + expression + parameter?
At this moment, we are not sure if the issue is on your side (perhaps parameter are wrongly passed) or our side since we don't have the full information.
Best Regards,
Jon
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using dd_segmentation_lib.Models;
using DDModels;
using Jil;
using Z.Expressions;
namespace dd_segmentation_lib
{
public class SGX // Singleton
{
private static SGX _instance = new SGX();
public static SGX instance => _instance ??= new SGX();
static SGX() { }
private Dictionary<int, Segment> _segments;
private SGX()
{
_segments = new Dictionary<int, Segment>();
// get all active segments from redis
var rds = Redis.instance.GetDB();
var rdsRes = rds.HashGetAll(R.H("sgx::segments"));
foreach (var entry in rdsRes)
{
var segment = JSON.Deserialize<Segment>(entry.Value);
segment.evalFcn = Eval.Compile<Func<UserData, bool>>(segment.expression);
_segments[segment.segmentId] = segment;
}
}
public List<Segment> GetPlayerSegments(AccountState accountState)
{
var userData = new UserData()
{
state = accountState
};
var userSegments = new List<Segment>();
foreach (var segmentEntry in _segments)
{
// Console.WriteLine($"res: {segmentEntry.Value.evalFcn(userData)}");
if (segmentEntry.Value.evalFcn(userData))
userSegments.Add(segmentEntry.Value);
}
return userSegments;
}
}
}
Hello @chenmark1 ,
I don't think that will be enough.
We really need something we can run for this issue. That kind of issue as said is normally due to something missing or for example, state
should be case sensitive State
.
It's currently to hard to investigate it with the current information.
If you want to keep your code private, you can send it to us here: info@zzzprojects.com
Hello @chenmark1,
Since our last conversation, we haven't heard from you.
As mentioned in my previous email, you can send us your code on our company's email info@zzzprojects.com.
Looking forward to hearing from you,
Jon
Hello @chenmark1
A quick reminder that we are here to assist you.
Feel free to send us your code on our mailbox info@zzzprojects.com
Best regards,
Jon
Hello @chenmark1
Since we haven't heard back, we will close this issue.
Feel free to contact us once you can provide more information.
Best regards,
Jon
Hello!
Maybe you can help us with the below expression : state.town.buildings.Values.Any(b => b.isDamaged == true)
Unhandled exception. System.TypeInitializationException: The type initializer for 'dd_segmentation_lib.Segmentation' threw an exception. ---> System.Exception: Oops! No applicable member has been found for the expression. The error occurred for expression "." at position 94 near ".Any(b => b.Value.isDa".
Any idea what am I doing wrong?