Records: float => double

This commit is contained in:
Michał Zieliński
2024-03-09 08:53:47 +01:00
parent f9c1a8a8ad
commit fbcb46046e
7 changed files with 58 additions and 60 deletions

View File

@@ -102,9 +102,9 @@ namespace WebAPI.dataProcessors
};
int lastDayInMonth = DateTime.DaysInMonth(year, month);
float previousValue = 0;
double previousValue = 0;
//day 1
float firstVal = codeRecords
double firstVal = codeRecords
.Where(x => x.CreatedAt.Date <= new DateTime(year, month, 1))
.OrderByDescending(x => x.CreatedAt)
.FirstOrDefault()?.Value1 ?? 0;
@@ -113,7 +113,7 @@ namespace WebAPI.dataProcessors
//days 2-29/30
for (int i=2; i<lastDayInMonth; i++)
{
float? dayVal = codeRecords
double? dayVal = codeRecords
.Where(x => x.CreatedAt.Day == i && x.CreatedAt.Month == month)
.OrderByDescending(x => x.CreatedAt)
.FirstOrDefault()?.Value1;
@@ -123,13 +123,13 @@ namespace WebAPI.dataProcessors
ProcessHelper.setValue(processedRecord, i, 0);
} else
{
float processedVal = (dayVal ?? 0) - previousValue;
double processedVal = (dayVal ?? 0) - previousValue;
ProcessHelper.setValue(processedRecord, i, processedVal);
previousValue = dayVal ?? 0;
}
}
//last day
float? lastVal = codeRecords
double? lastVal = codeRecords
.Where(x => x.CreatedAt.Date >= new DateTime(year, month, lastDayInMonth))
.OrderByDescending(x => x.CreatedAt)
.FirstOrDefault()?.Value1;
@@ -143,7 +143,7 @@ namespace WebAPI.dataProcessors
}
// copy last value
float? valueToCopy = codeRecords
double? valueToCopy = codeRecords
.OrderByDescending(x => x.CreatedAt)
.FirstOrDefault()?.Value1;
ProcessHelper.setValue(processedRecord, 32, valueToCopy);