Skip to content

Commit

Permalink
Bugfix add ParameterOverride
Browse files Browse the repository at this point in the history
  • Loading branch information
lxatrhea committed Feb 16, 2021
1 parent b8ffbea commit 4058b67
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions CDP4WebServices.API/Services/ChangeLog/ChangeLogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
namespace CDP4WebServices.API.Services.ChangeLog
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -669,20 +670,37 @@ private void AddChangedThingIidLine(NpgsqlTransaction transaction, string partit
this.ResolveService.ResolveItems(transaction, partition, resolverDictionary);

var changedValueThing = service.GetShallow(transaction, dtoResolverHelper.Partition, new[] { changedValue }, securityContext).FirstOrDefault();
var changedNamedThing = changedValueThing as INamedThing;

var orgValue = metaInfoProvider.GetValue(propertyName, originalThing);

var orgValueThing = orgValue == null
? null
: service.GetShallow(transaction, dtoResolverHelper.Partition, new[] { (Guid) orgValue }, securityContext).FirstOrDefault();

var changedNamedThing = changedValueThing as INamedThing;
var orgNamedThing = orgValueThing as INamedThing;

if ((changedNamedThing ?? orgNamedThing) != null)
if (orgValue is IEnumerable)
{
stringBuilder.AppendLine($" - {propertyName}: {orgNamedThing?.Name} => {changedNamedThing?.Name}");
return;
if (changedNamedThing != null)
{
stringBuilder.AppendLine($" - {propertyName}: Added => {changedNamedThing.Name}");
return;
}

if (changedValueThing != null)
{
stringBuilder.AppendLine($" - {propertyName}: Added => {changedValueThing.ClassKind}");
return;
}
}
else
{
if (orgValue != null)
{
var orgValueThing = service.GetShallow(transaction, dtoResolverHelper.Partition, new[] { (Guid) orgValue }, securityContext).FirstOrDefault();
var orgNamedThing = orgValueThing as INamedThing;

if ((changedNamedThing ?? orgNamedThing) != null)
{
stringBuilder.AppendLine($" - {propertyName}: {orgNamedThing?.Name} => {changedNamedThing?.Name}");
return;
}
}
}

stringBuilder.AppendLine($" - {propertyName} was changed");
Expand Down

0 comments on commit 4058b67

Please sign in to comment.