Skip to content
Snippets Groups Projects
Commit e8da55f8 authored by Philipp Müller's avatar Philipp Müller
Browse files

Merge branch 'dummyTime' into 'develop'

add a dummy value to the distraction and total time to allow starting in stage 4 instead of 1

See merge request !23
parents 7a606e6f cd79087c
No related branches found
No related tags found
1 merge request!23add a dummy value to the distraction and total time to allow starting in stage 4 instead of 1
...@@ -58,10 +58,14 @@ namespace InnoLabProjektDektopApp.Services ...@@ -58,10 +58,14 @@ namespace InnoLabProjektDektopApp.Services
public void CalculateCurrentDistractionStage(DateTime endTime) public void CalculateCurrentDistractionStage(DateTime endTime)
{ {
TimeSpan totalDistractionTime = CalculateTotalDistractionTime(); TimeSpan totalDistractionTime = CalculateTotalDistractionTime();
Debug.WriteLine("Total distraction time: {0}", totalDistractionTime); Debug.WriteLine("Total distraction time: {0}", totalDistractionTime);
double totalMinutes = (endTime - startTime).TotalMinutes;
double distractedMinutes = totalDistractionTime.TotalMinutes; // Adds a dummy value to the distractedMinutes and totalMinutes so the stage starts in the middle
double dummyTimeInMinutes = 8;
double totalMinutes = (endTime - startTime).TotalMinutes + 2 * dummyTimeInMinutes;
double distractedMinutes = totalDistractionTime.TotalMinutes + dummyTimeInMinutes;
double distractionFraction = (distractedMinutes / totalMinutes); double distractionFraction = (distractedMinutes / totalMinutes);
int stage = (int)Math.Ceiling(distractionFraction * 7); int stage = (int)Math.Ceiling(distractionFraction * 7);
Debug.WriteLine($"Distraction stage: {stage}"); Debug.WriteLine($"Distraction stage: {stage}");
...@@ -71,10 +75,8 @@ namespace InnoLabProjektDektopApp.Services ...@@ -71,10 +75,8 @@ namespace InnoLabProjektDektopApp.Services
{ {
var processName = Path.GetFileNameWithoutExtension((string)((ManagementBaseObject)e["TargetInstance"])["Name"]); var processName = Path.GetFileNameWithoutExtension((string)((ManagementBaseObject)e["TargetInstance"])["Name"]);
if (processStartTimes.TryGetValue(processName, out _)) // Check if the process is already being tracked
{ if (processStartTimes.TryGetValue(processName, out _)) return;
return;
}
processStartTimes[processName] = DateTime.Now; processStartTimes[processName] = DateTime.Now;
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment