aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs20
1 files changed, 10 insertions, 10 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs
index ed52c2352..ed7bbec56 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs
@@ -256,7 +256,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels
{
using (ObservablesContext db = ObservablesContext.CreateDefault())
{
- return db.Jobs.Where(x => x.Name!= null && x.Name.ToLower().Contains(filter.ToLower())).ToList();
+ return db.Jobs.Where(x => x.Name != null && x.Name.ToLower().Contains(filter.ToLower())).ToList();
}
}
else
@@ -270,7 +270,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels
return null;
}
});
-
+
StatisticsValueCollection = new StatisticsValueCollection();
}
@@ -329,7 +329,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels
.WithJobStatus(JobRunSelectedStatuses.SynchedSource)
.WithGradient(IsGradientSelection.SynchedSource)
.WithRmls(SelectedThreads.SynchedSource.Select(x => x.Guid).ToList())
- .Query(y => y.Where(x => ( String.IsNullOrEmpty(jobName) || x.JobName.ToLower().StartsWith(jobName.ToLower()))
+ .Query(y => y.Where(x => (String.IsNullOrEmpty(jobName) || x.JobName.ToLower().StartsWith(jobName.ToLower()))
&& (x.JobLength < LengthUpperValue && x.JobLength >= LengthLowerValue)))
.BuildListAsync();
@@ -346,7 +346,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels
GenerateStatistics();
}
-
+
}
catch (Exception ex)
{
@@ -404,8 +404,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels
/// </summary>
protected void GenerateAverageUploadDuration()
{
- var average = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.UploadDuration != null && z.UploadDuration.Value.Ticks > 0).Average(x => x.UploadDuration.Value.TotalMinutes);
- StatisticsValueCollection.AddStatisticsValue("Average Upload Duration", Math.Max(average, 0), " minutes");
+ var val = (long)JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.UploadDuration != null).Average(x => x.UploadDuration.Value.TotalMilliseconds);
+ StatisticsValueCollection.AddStatisticsValue("Average Upload Duration", Math.Max(TimeSpan.FromMilliseconds(val).TotalMinutes, 0), " minutes");
}
/// <summary>
@@ -452,7 +452,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels
protected void CreateThreadConsumptionPerThread()
{
var temp = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.Rml != null).GroupBy(x => x.Rml.Name);
- List <StatisticsValue> result = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.Rml != null && !String.IsNullOrEmpty(z.Rml.Name)).GroupBy(x => x.Rml.Name).Select(y => new StatisticsValue { Name = y.Key, Value = y.Sum(x => x.JobRun.EndPosition), Unit="m" }).ToList();
+ List<StatisticsValue> result = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.Rml != null && !String.IsNullOrEmpty(z.Rml.Name)).GroupBy(x => x.Rml.Name).Select(y => new StatisticsValue { Name = y.Key, Value = y.Sum(x => x.JobRun.EndPosition), Unit = "m" }).ToList();
StatisticsValueCollection.CreateThreadConsumptionPerThread(result);
}
@@ -461,12 +461,12 @@ namespace Tango.MachineStudio.Statistics.ViewModels
/// </summary>
protected void GenerateAllLiquidQuantities()
{
- var db_liquidQuantities = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.JobRun.LiquidQuantities.Count > 0).Select(y=> y.JobRun.LiquidQuantities).ToList();
+ var db_liquidQuantities = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.JobRun.LiquidQuantities.Count > 0).Select(y => y.JobRun.LiquidQuantities).ToList();
List<JobRunLiquidQuantity> allLiquidQuantities = new List<JobRunLiquidQuantity>();
-
+
foreach (LiquidTypes ltype in (LiquidTypes[])Enum.GetValues(typeof(LiquidTypes)))
{
- var liquidQuantityByTypeList = db_liquidQuantities.Select(x => x.FirstOrDefault(y => y.LiquidType == ltype)).Where(x=>x!=null);
+ var liquidQuantityByTypeList = db_liquidQuantities.Select(x => x.SingleOrDefault(y => y.LiquidType == ltype)).Where(x => x != null);
var count = liquidQuantityByTypeList != null ? liquidQuantityByTypeList.Sum(x => x.Quantity) : 0;
JobRunLiquidQuantity lq = new JobRunLiquidQuantity() { LiquidType = ltype, Quantity = count };
allLiquidQuantities.Add(lq);