aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Telemetry/Mappers
diff options
context:
space:
mode:
authorRoy Ben Shabat <roy.mail.net@gmail.com>2025-09-09 06:51:14 +0300
committerRoy Ben Shabat <roy.mail.net@gmail.com>2025-09-09 06:51:14 +0300
commit1cbef6c4d79a1db8c8d3923edfec2e50277caa51 (patch)
tree6487fb1a2e4c85327bc74348018ad1621cc28fba /Software/Visual_Studio/Tango.Telemetry/Mappers
parent987e4992d01a0bc84170498c40dad0621542f46c (diff)
downloadTango-1cbef6c4d79a1db8c8d3923edfec2e50277caa51.tar.gz
Tango-1cbef6c4d79a1db8c8d3923edfec2e50277caa51.zip
RMl Default Liquid Factor + Machine Type + Improved RML Filter Loading.
Diffstat (limited to 'Software/Visual_Studio/Tango.Telemetry/Mappers')
-rw-r--r--Software/Visual_Studio/Tango.Telemetry/Mappers/JobRunMapper.cs54
1 files changed, 37 insertions, 17 deletions
diff --git a/Software/Visual_Studio/Tango.Telemetry/Mappers/JobRunMapper.cs b/Software/Visual_Studio/Tango.Telemetry/Mappers/JobRunMapper.cs
index 8d8023c95..81bff1eb4 100644
--- a/Software/Visual_Studio/Tango.Telemetry/Mappers/JobRunMapper.cs
+++ b/Software/Visual_Studio/Tango.Telemetry/Mappers/JobRunMapper.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Data.Entity;
using System.IO;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Tango.BL;
@@ -63,6 +64,8 @@ namespace Tango.Telemetry.Mappers
}
}
+
+
public static TelemetryJobRun MapJobRun(JobRun run)
{
Init();
@@ -106,23 +109,7 @@ namespace Tango.Telemetry.Mappers
tRun.Status = run.JobRunStatus.ToString();
- tRun.OutputCyan = run.CyanQuantity;
- tRun.OutputMagenta = run.MagentaQuantity;
- tRun.OutputYellow = run.YellowQuantity;
- tRun.OutputBlack = run.BlackQuantity;
- tRun.OutputLightCyan = run.LightCyanQuantity;
- tRun.OutputLightMagenta = run.LightMagentaQuantity;
- tRun.OutputLightYellow = run.LightYellowQuantity;
- tRun.OutputBlue = run.BlueQuantity;
- tRun.OutputLightBlue = run.LightBlueQuantity;
- tRun.OutputOrange = run.OrangeQuantity;
- tRun.OutputLightOrange = run.LightOrangeQuantity;
- tRun.OutputRubine = run.RubineQuantity;
- tRun.OutputLightRubine = run.LightRubineQuantity;
- tRun.OutputNavy = run.NavyQuantity;
- tRun.OutputViolet = run.VioletQuantity;
- tRun.OutputTransparent = run.TransparentQuantity;
- tRun.OutputLubricant = run.LubricantQuantity;
+ MapToOutputs(run, tRun);
tRun.FailureReason = run.FailedMessage;
@@ -319,5 +306,38 @@ namespace Tango.Telemetry.Mappers
return tRun;
}
+
+ public static void MapToOutputs(JobRun run, TelemetryJobRun tRun)
+ {
+ if (run == null || tRun == null) return;
+
+ var runProps = run.GetType()
+ .GetProperties(BindingFlags.Instance | BindingFlags.Public)
+ .Where(p => p.CanRead && p.PropertyType == typeof(long))
+ .Where(p => p.Name.EndsWith("Quantity", StringComparison.OrdinalIgnoreCase))
+ .ToDictionary(p => p.Name.ToLower(), p => p);
+
+ var tRunProps = tRun.GetType()
+ .GetProperties(BindingFlags.Instance | BindingFlags.Public)
+ .Where(p => p.CanWrite && p.PropertyType == typeof(long))
+ .Where(p => p.Name.StartsWith("Output", StringComparison.OrdinalIgnoreCase))
+ .ToDictionary(p => p.Name.ToLower(), p => p);
+
+ foreach (var tProp in tRunProps.Values)
+ {
+ // "OutputCyan" -> "CyanQuantity"
+ var baseName = tProp.Name.Substring("Output".Length);
+ var runKey = (baseName + "Quantity").ToLower();
+
+ if (!runProps.TryGetValue(runKey, out var runProp))
+ {
+ LogManager.Default.Log($"Could not locate liquid quantity field {runKey} for JobRun Telemetry object.", LogCategory.Warning);
+ continue;
+ }
+
+ var value = (long)(runProp.GetValue(run) ?? 0L);
+ tProp.SetValue(tRun, value);
+ }
+ }
}
}