Фикс получения фиктивных суточных отчётов

This commit is contained in:
Степанов Дмитрий 2024-04-15 10:09:07 +03:00
parent f2867794d1
commit 139a66a2c9
2 changed files with 4 additions and 5 deletions

View File

@ -177,8 +177,7 @@ public class DailyReportService : IDailyReportService
datesRange.To = finishDate;
}
result.Count = (int)(Math.Ceiling((datesRange.To - DateTimeOffset.UnixEpoch).TotalDays)
- Math.Floor((datesRange.From - DateTimeOffset.UnixEpoch).TotalDays));
result.Count = (datesRange.To.Day - DateTimeOffset.UnixEpoch.Day) - (datesRange.From.Day - DateTimeOffset.UnixEpoch.Day);
var existingDailyReports = await dailyReportRepository.GetAsync(idWell, request, cancellationToken);

View File

@ -157,7 +157,7 @@ public class DailyReportServiceTest
IdParentCategory = 4001,
IdWellSectionType = 1,
OperationCategoryName = "Механическое. бурение",
DateStart = new DateTime(2023, 10, 26),
DateStart = new DateTime(2023, 10, 26, 0, 0, 0),
DepthStart = 80,
DepthEnd = 150,
DurationHours = 8,
@ -169,7 +169,7 @@ public class DailyReportServiceTest
OperationCategoryName = "Механическое. бурение",
IdWellSectionType = 1,
IdParentCategory = 4001,
DateStart = new DateTime(2023, 10, 26),
DateStart = new DateTime(2023, 10, 26, 23, 59, 59),
DepthStart = 150,
DepthEnd = 200,
DurationHours = 8,
@ -507,7 +507,7 @@ public class DailyReportServiceTest
public async Task GetAsync_ShouldReturn_FictiveDailyReport()
{
//arrange
var expectedCount = (fakeLastFactWellOperation.DateStart - fakeFirstFactWellOperation.DateStart).TotalDays + 1;
var expectedCount = fakeLastFactWellOperation.DateStart.Day - fakeFirstFactWellOperation.DateStart.Day;
//act
var result = await dailyReportService.GetAsync(idWell, new FileReportRequest(), CancellationToken.None);