diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-03-15 15:46:03 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-03-15 15:46:03 +0200 |
| commit | b188d7bfd91062f65474bd139bb8a434694f117b (patch) | |
| tree | b75e5628482d4f96fc4236beaf854152d83292a4 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics | |
| parent | 47d63f4b155318d674a891a6586433f41881a3b1 (diff) | |
| download | Tango-b188d7bfd91062f65474bd139bb8a434694f117b.tar.gz Tango-b188d7bfd91062f65474bd139bb8a434694f117b.zip | |
Fixed issue with job run start date.
Fixed issue with ActionLogs busy indication.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs | 23 |
1 files changed, 11 insertions, 12 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 d57a1c96c..9bf69137d 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 @@ -188,7 +188,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels RaisePropertyChangedAuto(); } } - + public StatisticsValueCollection StatisticsValueCollection { get; set; } #endregion @@ -253,7 +253,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 @@ -267,7 +267,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels return null; } }); - + StatisticsValueCollection = new StatisticsValueCollection(); } @@ -326,7 +326,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(); @@ -343,7 +343,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels GenerateStatistics(); } - + } catch (Exception ex) { @@ -387,9 +387,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels protected void GenerateUploadDuration() { - var val = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.UploadDuration != null).Average(x => x.UploadDuration.Value.Ticks); - TimeSpan ts = new TimeSpan(Convert.ToInt64(val)); - StatisticsValueCollection.AddStatisticsValue("Average Upload Duration", Math.Max(ts.TotalMinutes, 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"); } protected void GenerateHeatingDuration() @@ -425,18 +424,18 @@ 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); } 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.SingleOrDefault(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); |
