Ready to test

This commit is contained in:
Mike Phares 2024-06-04 14:07:11 -07:00
parent f0f601ecdf
commit 0bd984057f
3 changed files with 44 additions and 14 deletions

View File

@ -25,11 +25,11 @@ public class ProcessData : IProcessData
Parse(fileRead, logistics, fileInfoCollection, sheetName); Parse(fileRead, logistics, fileInfoCollection, sheetName);
} }
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors) string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors) =>
=> throw new Exception(string.Concat("See ", nameof(Parse))); throw new Exception(string.Concat("See ", nameof(Parse)));
Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection) Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection) =>
=> new(logistics.Logistics1[0], Array.Empty<Test>(), Array.Empty<JsonElement>(), fileInfoCollection); new(logistics.Logistics1[0], Array.Empty<Test>(), Array.Empty<JsonElement>(), fileInfoCollection);
#nullable enable #nullable enable

View File

@ -158,10 +158,10 @@ public class FileRead : Shared.FileRead, IFileRead
else else
{ {
string formattedDateTime = dateTime.ToString("yyyy-MM-dd"); string formattedDateTime = dateTime.ToString("yyyy-MM-dd");
bool forceUpdatedBy = !_IsEAFHosted || (dateTime.DayOfWeek == DayOfWeek.Thursday && dateTime.Hour == 12 && _LastDateForcedUpdatedBy != formattedDateTime); bool forceUpdatedBy = false; // !_IsEAFHosted || (dateTime.DayOfWeek == DayOfWeek.Thursday && dateTime.Hour == 12 && _LastDateForcedUpdatedBy != formattedDateTime);
if (forceUpdatedBy) if (forceUpdatedBy)
_LastDateForcedUpdatedBy = formattedDateTime; _LastDateForcedUpdatedBy = formattedDateTime;
bool forceDeleteUpdatedBy = !_IsEAFHosted || (dateTime.DayOfWeek == DayOfWeek.Thursday && dateTime.Hour == 18 && _LastDateDeleteForcedUpdatedBy != formattedDateTime); bool forceDeleteUpdatedBy = false; // !_IsEAFHosted || (dateTime.DayOfWeek == DayOfWeek.Thursday && dateTime.Hour == 18 && _LastDateDeleteForcedUpdatedBy != formattedDateTime);
if (forceDeleteUpdatedBy) if (forceDeleteUpdatedBy)
_LastDateDeleteForcedUpdatedBy = formattedDateTime; _LastDateDeleteForcedUpdatedBy = formattedDateTime;
IProcessData iProcessData = new ProcessData(this, IProcessData iProcessData = new ProcessData(this,

View File

@ -17,6 +17,7 @@ using System.Net.Http;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Adaptation.FileHandlers.json; namespace Adaptation.FileHandlers.json;
@ -63,17 +64,25 @@ public class ProcessData : IProcessData
forceDeleteUpdatedBy); forceDeleteUpdatedBy);
} }
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors) string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors) =>
=> throw new Exception(string.Concat("See ", nameof(Parse))); throw new Exception(string.Concat("See ", nameof(Parse)));
Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection) Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection) =>
=> new(logistics.Logistics1[0], Array.Empty<Test>(), Array.Empty<JsonElement>(), fileInfoCollection); new(logistics.Logistics1[0], Array.Empty<Test>(), Array.Empty<JsonElement>(), fileInfoCollection);
internal static List<Description> GetDescriptions(JsonElement[] jsonElements) => throw new NotImplementedException(); internal static List<Description> GetDescriptions(JsonElement[] jsonElements) =>
throw new NotImplementedException();
#nullable enable #nullable enable
private static void AddPatch(JsonPatchDocument document, string path, object value) => document.Add(new JsonPatchOperation { From = null, Operation = Operation.Add, Path = path, Value = value }); private static void KillTime(int loops)
{
for (int i = 1; i < loops; i++)
Thread.Sleep(500);
}
private static void AddPatch(JsonPatchDocument document, string path, object value) =>
document.Add(new JsonPatchOperation { From = null, Operation = Operation.Add, Path = path, Value = value });
private static Dictionary<string, FIBacklogMesa> GetFIBacklogMesaCollection(string json) private static Dictionary<string, FIBacklogMesa> GetFIBacklogMesaCollection(string json)
{ {
@ -182,10 +191,28 @@ public class ProcessData : IProcessData
private static DateTime? GetCommitDate(FIBacklogMesa fiBacklogMesa) private static DateTime? GetCommitDate(FIBacklogMesa fiBacklogMesa)
{ {
DateTime? result; DateTime? result;
if (!DateTime.TryParseExact(fiBacklogMesa.CommitDate.Split(' ').First(), "MM/dd/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTime) && dateTime != DateTime.MinValue) DateTime dateTime;
DateTime minDateTime = DateTime.MinValue.AddYears(10);
string commitDate = fiBacklogMesa.CommitDate.Split(' ')[0];
if (string.IsNullOrEmpty(commitDate))
result = null; result = null;
else else
{
if (DateTime.TryParseExact(commitDate, "MM/dd/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime) && dateTime >= minDateTime)
result = dateTime.AddHours(12).ToUniversalTime(); result = dateTime.AddHours(12).ToUniversalTime();
else
{
if (DateTime.TryParseExact(commitDate, "dd-MMM-yy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime) && dateTime >= minDateTime)
result = dateTime.AddHours(12).ToUniversalTime();
else
{
if (DateTime.TryParse(commitDate, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime) && dateTime >= minDateTime)
result = dateTime.AddHours(12).ToUniversalTime();
else
result = null;
}
}
}
return result; return result;
} }
@ -378,6 +405,7 @@ public class ProcessData : IProcessData
throw new Exception(httpResponseMessageTask.Result.StatusCode.ToString()); throw new Exception(httpResponseMessageTask.Result.StatusCode.ToString());
Task<string> stringTask = httpResponseMessageTask.Result.Content.ReadAsStringAsync(); Task<string> stringTask = httpResponseMessageTask.Result.Content.ReadAsStringAsync();
stringTask.Wait(); stringTask.Wait();
KillTime(30);
} }
private static void ForceUpdatedBy(HttpClient httpClient, string basePage, string project, string api, string forceUpdatedByComment, ReadOnlyDictionary<string, List<int>> updateCollection) private static void ForceUpdatedBy(HttpClient httpClient, string basePage, string project, string api, string forceUpdatedByComment, ReadOnlyDictionary<string, List<int>> updateCollection)
@ -409,6 +437,7 @@ public class ProcessData : IProcessData
throw new Exception(httpResponseMessageTask.Result.StatusCode.ToString()); throw new Exception(httpResponseMessageTask.Result.StatusCode.ToString());
Task<string> stringTask = httpResponseMessageTask.Result.Content.ReadAsStringAsync(); Task<string> stringTask = httpResponseMessageTask.Result.Content.ReadAsStringAsync();
stringTask.Wait(); stringTask.Wait();
KillTime(30);
} }
private static void ForceUpdatedByDelete(HttpClient httpClient, string basePage, string project, string api, ReadOnlyDictionary<string, List<int[]>> deleteCollection) private static void ForceUpdatedByDelete(HttpClient httpClient, string basePage, string project, string api, ReadOnlyDictionary<string, List<int[]>> deleteCollection)
@ -443,6 +472,7 @@ public class ProcessData : IProcessData
Task<string> stringTask = httpResponseMessageTask.Result.Content.ReadAsStringAsync(); Task<string> stringTask = httpResponseMessageTask.Result.Content.ReadAsStringAsync();
stringTask.Wait(); stringTask.Wait();
#endif #endif
KillTime(30);
} }
private static void UpdateIds(HttpClient httpClient, string basePage, string api, string[] checkFiles) private static void UpdateIds(HttpClient httpClient, string basePage, string api, string[] checkFiles)