aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs
diff options
context:
space:
mode:
authorRoy <Roy.mail.net@gmail.com>2022-11-19 14:43:46 +0200
committerRoy <Roy.mail.net@gmail.com>2022-11-19 14:43:46 +0200
commit4cd4807ca5a7490c8d7edac496a19d618bf9197e (patch)
treee1f6c1565c242584f4cd8f62160ce2777779881a /Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs
parentaa2170bb476e627ae3aaccb8f5835b1b9331c82a (diff)
downloadTango-4cd4807ca5a7490c8d7edac496a19d618bf9197e.tar.gz
Tango-4cd4807ca5a7490c8d7edac496a19d618bf9197e.zip
Statistics Fine Tuning Adaptation.
Diffstat (limited to 'Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs')
-rw-r--r--Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs89
1 files changed, 84 insertions, 5 deletions
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs
index 2b46ad72f..7d71193f9 100644
--- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs
@@ -1,4 +1,5 @@
-using System;
+using Newtonsoft.Json;
+using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data.Entity;
@@ -13,6 +14,7 @@ using Tango.BL;
using Tango.BL.DTO;
using Tango.BL.Entities;
using Tango.BL.Enumerations;
+using Tango.BL.FineTuning;
using Tango.Core;
using Tango.Core.Commands;
using Tango.Core.ExtensionMethods;
@@ -35,6 +37,8 @@ namespace Tango.FSE.Statistics.ViewModels
private const int NULL_JOB_INDEX = -1000;
private int _currentJobIndex;
private StatisticsModel _model;
+ private String _currentFineTuningSessionID;
+ private List<StopModel> _fineTuningStops;
#region Properties
@@ -92,6 +96,13 @@ namespace Tango.FSE.Statistics.ViewModels
set { _jobRunSelectedStatuses = value; RaisePropertyChangedAuto(); }
}
+ private SelectedObjectCollection<JobDesignations> _jobRunSelectedDesignations;
+ public SelectedObjectCollection<JobDesignations> JobRunSelectedDesignations
+ {
+ get { return _jobRunSelectedDesignations; }
+ set { _jobRunSelectedDesignations = value; RaisePropertyChangedAuto(); }
+ }
+
private SelectedObjectCollection<ThreadFilterData> _selectedThreads;
public SelectedObjectCollection<ThreadFilterData> SelectedThreads
{
@@ -176,6 +187,8 @@ namespace Tango.FSE.Statistics.ViewModels
public RelayCommand OpenStreamingSettingsCommand { get; set; }
+ public RelayCommand ClearCommand { get; set; }
+
#endregion
#region Suggestions Providers
@@ -205,9 +218,25 @@ namespace Tango.FSE.Statistics.ViewModels
JobRunStatus.Failed,
});
+
+ JobRunSelectedDesignations = new SelectedObjectCollection<JobDesignations>(new ObservableCollection<JobDesignations>()
+ {
+ JobDesignations.Default,
+ JobDesignations.FineTuning,
+
+ }, new ObservableCollection<JobDesignations>()
+ {
+ JobDesignations.Default,
+ JobDesignations.FineTuning,
+ });
+
+
JobRunSelectedStatuses.SelectionChanged -= (x, y) => RaisePropertyChanged(nameof(JobRunSelectedStatuses));
JobRunSelectedStatuses.SelectionChanged += (x, y) => RaisePropertyChanged(nameof(JobRunSelectedStatuses));
+ JobRunSelectedDesignations.SelectionChanged -= (x, y) => RaisePropertyChanged(nameof(JobRunSelectedDesignations));
+ JobRunSelectedDesignations.SelectionChanged += (x, y) => RaisePropertyChanged(nameof(JobRunSelectedDesignations));
+
JobsAutoCompleteProvider = new AutoCompleteSource<string>(AutoCompleteJobs);
StartSelectedDate = DateTime.Now.AddMonths(-1);
@@ -230,6 +259,7 @@ namespace Tango.FSE.Statistics.ViewModels
CopyCommand = new RelayCommand<StopModel>(CopyStopToClipboard);
ExportToCsvCommand = new RelayCommand(ExportToCSV, () => IsResultsAvailable);
OpenStreamingSettingsCommand = new RelayCommand(OpenStreamingSettings);
+ ClearCommand = new RelayCommand(Clear);
}
#endregion
@@ -281,7 +311,7 @@ namespace Tango.FSE.Statistics.ViewModels
}
#endregion
-
+
#region Statistics Methods
private async Task LoadFiltersData()
@@ -311,6 +341,7 @@ namespace Tango.FSE.Statistics.ViewModels
filters.StartDateUTC = StartSelectedDate;
filters.EndDateUTC = EndSelectedDate;
filters.EndStatuses = JobRunSelectedStatuses.SynchedSource.Cast<int>().ToList();
+ filters.JobDesignation = JobRunSelectedDesignations.SynchedSource.Cast<int>().ToList();
filters.IncludeHeadCleaning = IncludeHeadCleaning;
filters.JobName = JobName;
filters.ExactJobName = JobNameExact;
@@ -323,6 +354,8 @@ namespace Tango.FSE.Statistics.ViewModels
List<StopModel> stops = new List<StopModel>();
_currentJobIndex = 0;
+ _currentFineTuningSessionID = null;
+ _fineTuningStops = new List<StopModel>();
foreach (var job in _model.StatisticsResult.JobRuns.OrderByDescending(x => x.JobRun.StartDate))
{
@@ -351,7 +384,7 @@ namespace Tango.FSE.Statistics.ViewModels
}
catch (Exception ex)
{
- NotificationProvider.PushErrorReportingSnackbar(ex, "Statistics Module Error", "Error statistics from the remote machine.");
+ NotificationProvider.PushErrorReportingSnackbar(ex, "Statistics Module Error", "Error getting statistics from the remote machine.");
}
}
@@ -361,7 +394,22 @@ namespace Tango.FSE.Statistics.ViewModels
var rmlName = FiltersData.Rmls.FirstOrDefault(x => x.Guid == job.JobRun.RmlGuid)?.Name;
- _currentJobIndex++;
+ VectorFineTuningRunModel fineTuningModel = null;
+
+ if (job.JobRun.JobDesignation == (int)JobDesignations.FineTuning && job.JobRun.FineTuningString != null)
+ {
+ fineTuningModel = JsonConvert.DeserializeObject<VectorFineTuningRunModel>(job.JobRun.FineTuningString);
+ if (fineTuningModel.FineTuningSessionID != _currentFineTuningSessionID)
+ {
+ _fineTuningStops = new List<StopModel>();
+ _currentFineTuningSessionID = fineTuningModel.FineTuningSessionID;
+ _currentJobIndex++;
+ }
+ }
+ else
+ {
+ _currentJobIndex++;
+ }
foreach (var jobSegment in job.Job.Segments)
{
@@ -373,6 +421,20 @@ namespace Tango.FSE.Statistics.ViewModels
stop.SegmentIndex = job.Job.Segments.IndexOf(jobSegment) + 1;
stop.ThreadName = rmlName;
stop.IsAdvancedMode = !BuildProvider.IsTwineRSM && CurrentUser.HasRole(Roles.FSEAdvancedTechnician);
+ stop.FineTuningModel = fineTuningModel;
+
+ if (fineTuningModel != null)
+ {
+ stop.IsFineTuningApproved = fineTuningModel.Approved;
+ stop.IsFineTuningSelected = fineTuningModel.Approved;
+
+ _fineTuningStops.Add(stop);
+
+ if (_fineTuningStops.Exists(x => x.IsFineTuningApproved))
+ {
+ _fineTuningStops.ForEach(x => x.IsFineTuningApproved = true);
+ }
+ }
stop.ColorSpace = jobStop.ColorSpace;
@@ -479,6 +541,12 @@ namespace Tango.FSE.Statistics.ViewModels
return FiltersData.Jobs.Where(x => x != null).Where(x => x.ToLower().Contains(key.ToLower())).ToList();
}
+ private void Clear()
+ {
+ Stops?.Clear();
+ Stats = new StatsModel();
+ }
+
#endregion
#region Stop Commands Handler
@@ -578,7 +646,7 @@ namespace Tango.FSE.Statistics.ViewModels
}
#endregion
-
+
#region CSV Export
private async void ExportToCSV()
@@ -734,6 +802,17 @@ namespace Tango.FSE.Statistics.ViewModels
Stops.Clear();
}
+ if (stops.First().IsFineTuning && stops.First().FineTuningModel != null)
+ {
+ var sessionStop = Stops.Where(x => x.IsFineTuning).FirstOrDefault(x => x.FineTuningModel.FineTuningSessionID == stops[0].FineTuningModel.FineTuningSessionID);
+
+ if (sessionStop != null)
+ {
+ stops.First().JobIndex = sessionStop.JobIndex;
+ stops.First().IsFineTuningApproved = sessionStop.IsFineTuningApproved;
+ }
+ }
+
foreach (var stop in stops)
{
Stops.Insert(0, stop);