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

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

parent 7a606e6f
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
public void CalculateCurrentDistractionStage(DateTime endTime)
{
TimeSpan totalDistractionTime = CalculateTotalDistractionTime();
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);
int stage = (int)Math.Ceiling(distractionFraction * 7);
Debug.WriteLine($"Distraction stage: {stage}");
......@@ -71,10 +75,8 @@ namespace InnoLabProjektDektopApp.Services
{
var processName = Path.GetFileNameWithoutExtension((string)((ManagementBaseObject)e["TargetInstance"])["Name"]);
if (processStartTimes.TryGetValue(processName, out _))
{
return;
}
// Check if the process is already being tracked
if (processStartTimes.TryGetValue(processName, out _)) return;
processStartTimes[processName] = DateTime.Now;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment