fix & refactor dates

This commit is contained in:
vchikalkin 2021-03-30 15:08:42 +03:00
parent 1be80f1c20
commit 92f0aa29b5
2 changed files with 6 additions and 8 deletions

View File

@ -16,12 +16,8 @@ namespace EvoCalculator.Core.Calculation.v1.Columns
Values[2] = preparedValues.DeliveryTime switch
{
100000000 => preparedValues.PaymentDateNew == null
? Values[1].AddMonths(1)
: preparedValues.PaymentDateNew ?? DateTime.MinValue,
100000001 => preparedValues.PaymentDateNew == null
? Values[1].AddDays(constants.DeliveryDays)
: preparedValues.PaymentDateNew ?? DateTime.MinValue,
100000000 => preparedValues.PaymentDateNew ?? Values[1].AddMonths(1),
100000001 => preparedValues.PaymentDateNew ?? Values[1].AddDays(constants.DeliveryDays),
_ => Values[2]
};

View File

@ -8,10 +8,12 @@ namespace EvoCalculator.Core.Calculation.v1.Columns
public DateTempColumn(int count) : base(count)
{
}
public void ComputeValues(PreparedValues preparedValues)
{
Values[0] = preparedValues.DogDate;
Values[0] = preparedValues.PaymentDateNew != null && preparedValues.DeliveryTime == 100000001
? preparedValues.PaymentDateNew.Value.AddMonths(-1)
: preparedValues.DogDate;
Values[1] = Values[0];
Values[2] = preparedValues.PaymentDateNew ?? Values[1].AddMonths(1);