WorkLog: If there is matching overlap, try to keep Activity, description or tags

This commit is contained in:
2022-03-03 19:47:31 +01:00
parent 070ce10fae
commit 95a5e83b73

View File

@@ -553,7 +553,33 @@ namespace VAR.Toolbox.UI.Tools.WorkLog
// Add non-overlaping from A
foreach (WorkLogItem itemA in workLogA)
{
if (workLogB.Any(itemB => itemB.Overlaps(itemA))) { continue; }
bool skip = false;
foreach(WorkLogItem itemB in workLogB)
{
if (itemB.Overlaps(itemA))
{
skip = true;
// If there is matching overlap, try to keep Activity, description or tags
if (itemA.DateStart == itemB.DateStart && itemA.DateEnd == itemB.DateEnd)
{
if (string.IsNullOrEmpty(itemB.Activity))
{
itemB.Activity = itemA.Activity;
}
if (string.IsNullOrEmpty(itemB.Description))
{
itemB.Description = itemA.Description;
}
if (string.IsNullOrEmpty(itemB.Tags))
{
itemB.Tags = itemA.Tags;
}
break;
}
}
}
if (skip) { continue; }
newWorkLog.Add(itemA);
}