예제 #1
0
 public static ICustomerOrderDataPoint CalculateBucket(ICustomerOrderDataPoint dataPoint)
 {
     if (dataPoint.OrderDate.HasValue)
     {
         var diff = dataPoint.OrderDate - dataPoint.CohortDate;
         dataPoint.CohortPeriod = (diff.Value.Days / 7) + 1;
     }
     return(dataPoint);
 }
예제 #2
0
        private bool IsFirstOrder(ICustomerOrderDataPoint dataPoint, ICollection <ICustomerOrderDataPoint> data)
        {
            var firstOrderForCustomer = data.Where(d => d.Id == dataPoint.Id)
                                        .OrderBy(d => d.OrderDate)
                                        .FirstOrDefault();

            return(firstOrderForCustomer != null &&
                   firstOrderForCustomer.OrderDate == dataPoint.OrderDate);

            {
            }
        }