diff --git a/Src/WitsmlExplorer.Api/Services/LogObjectService.cs b/Src/WitsmlExplorer.Api/Services/LogObjectService.cs index 636dfba90..12497f1e4 100644 --- a/Src/WitsmlExplorer.Api/Services/LogObjectService.cs +++ b/Src/WitsmlExplorer.Api/Services/LogObjectService.cs @@ -367,20 +367,12 @@ private async Task LoadDataRecursive(List mnemonics, WitsmlLo { await using LogDataReader logDataReader = new(_witsmlClient, log, new List(mnemonics), null, startIndex, endIndex); WitsmlLogData logData = await logDataReader.GetNextBatch(cancellationToken); - if (!startIndex.GetValueAsString().Equals(log.StartDateTimeIndex)) - { - log.StartDateTimeIndex = startIndex.GetValueAsString(); - } - if (!endIndex.GetValueAsString().Equals(log.EndDateTimeIndex)) - { - log.EndDateTimeIndex = endIndex.GetValueAsString(); - } var allLogData = logData; while (logData != null) { if (progressReporter != null) { - double progress = LogWorkerTools.CalculateProgressBasedOnIndex(log, logData); + double progress = LogWorkerTools.CalculateProgressBasedOnIndex(log, logData, startIndex, endIndex); progressReporter.Report(progress); } logData = await logDataReader.GetNextBatch(cancellationToken); diff --git a/Src/WitsmlExplorer.Api/Workers/DownloadLogDataWorker.cs b/Src/WitsmlExplorer.Api/Workers/DownloadLogDataWorker.cs index e32ce0e34..d2c096e55 100644 --- a/Src/WitsmlExplorer.Api/Workers/DownloadLogDataWorker.cs +++ b/Src/WitsmlExplorer.Api/Workers/DownloadLogDataWorker.cs @@ -68,9 +68,9 @@ public DownloadLogDataWorker( var logData = await _logObjectService.ReadLogData(job.LogReference.WellUid, job.LogReference.WellboreUid, job.LogReference.Uid, job.Mnemonics.ToList(), job.StartIndexIsInclusive, job.LogReference.StartIndex, job.LogReference.EndIndex, true, cancellationToken, progressReporter); if (logData.CurveSpecifications == null) { - var message = "DownloadLogDataJob failed. Start or end indexes are out of range."; + var message = "DownloadLogDataJob failed. No data found in the given range."; Logger.LogError(message); - return (new WorkerResult(GetTargetWitsmlClientOrThrow().GetServerHostname(), false, message, message), null); + return (new WorkerResult(GetTargetWitsmlClientOrThrow().GetServerHostname(), false, message, message, jobId:job.JobInfo.Id), null); } return (job.ExportToLas) diff --git a/Src/WitsmlExplorer.Api/Workers/Tools/LogWorkerTools.cs b/Src/WitsmlExplorer.Api/Workers/Tools/LogWorkerTools.cs index 6412a33fd..aa574959d 100644 --- a/Src/WitsmlExplorer.Api/Workers/Tools/LogWorkerTools.cs +++ b/Src/WitsmlExplorer.Api/Workers/Tools/LogWorkerTools.cs @@ -63,7 +63,7 @@ public static async Task GetLogDataForCurve(IWitsmlClient witsmlC }; } - public static double CalculateProgressBasedOnIndex(WitsmlLog log, WitsmlLogData currentData) + public static double CalculateProgressBasedOnIndex(WitsmlLog log, WitsmlLogData currentData, CurveIndex start = null, CurveIndex end = null) { string index = currentData.Data.LastOrDefault()?.Data.Split(CommonConstants.DataSeparator).FirstOrDefault(); if (index == null) return 0; @@ -77,6 +77,15 @@ public static double CalculateProgressBasedOnIndex(WitsmlLog log, WitsmlLogData { string startIndex = log.StartDateTimeIndex; string endIndex = log.EndDateTimeIndex; + if (start != null && !start.GetValueAsString().Equals(log.StartDateTimeIndex)) + { + startIndex = start.GetValueAsString(); + } + if (end != null && !end.GetValueAsString().Equals(log.EndDateTimeIndex)) + { + endIndex = end.GetValueAsString(); + } + return (DateTime.Parse(index) - DateTime.Parse(startIndex)).TotalMilliseconds / (DateTime.Parse(endIndex) - DateTime.Parse(startIndex)).TotalMilliseconds; } } diff --git a/Src/WitsmlExplorer.Frontend/components/Modals/DownloadOptionsSelectionModal.tsx b/Src/WitsmlExplorer.Frontend/components/Modals/DownloadOptionsSelectionModal.tsx index 5ea90a3c6..a65164777 100644 --- a/Src/WitsmlExplorer.Frontend/components/Modals/DownloadOptionsSelectionModal.tsx +++ b/Src/WitsmlExplorer.Frontend/components/Modals/DownloadOptionsSelectionModal.tsx @@ -213,9 +213,8 @@ const DownloadOptionsSelectionModal = ( const outOfRange = new Date(startIndex).getTime() - new Date(log.startIndex).getTime() < 0 || - new Date(endIndex).getTime() - new Date(log.endIndex).getTime() > 0 - ? true - : false; + new Date(endIndex).getTime() - new Date(log.endIndex).getTime() > 0; + return ( )} {isTimeLog && selectedDownloadOption === DownloadOptions.All && (