Skip to content

Commit

Permalink
Fix the condition
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzhankoral committed Nov 13, 2024
1 parent a626339 commit cbfdd67
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions SpeckleAutomateDotnetExample/AutomateFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,23 @@ IEnumerable<ObjectToCheck> failedObjects
foreach (var failedObject in failedObjects)
{
var speckleTypeString = failedObject.SpeckleType.ToString();
string message = "";
if (failedObject.UValue == 0)
{
message =
$"{speckleTypeString[..^1]} has no any material that have thermal properties.";
}
else
{
message =
$"{speckleTypeString[..^1]} expected to have maximum {failedObject.ExpectedUValue} U-value but it is {failedObject.UValue}.";
}

automationContext.AttachResultToObjects(
ObjectResultLevel.Error,
speckleTypeString,
new[] { failedObject.Id },
$"{speckleTypeString[..^1]} expected to have maximum {failedObject.ExpectedUValue} U-value but it is {failedObject.UValue}."
message
);
}
}
Expand Down Expand Up @@ -171,7 +183,7 @@ SpeckleType speckleType
expectedValue,
speckleType
));
return objectsToCheck.Where(obj => obj.UValue < expectedValue);
return objectsToCheck.Where(obj => obj.UValue > expectedValue || obj.UValue == 0);
}

private static ClimateZone GetClimateZone(string climateZoneString)
Expand Down

0 comments on commit cbfdd67

Please sign in to comment.