Skip to content

Commit

Permalink
Progress shouldn't depend on deleted subnodes
Browse files Browse the repository at this point in the history
The number of needs unsatisfied nodes it should be counting is the
number of root nodes that have been removed, not subnodes as well
  • Loading branch information
blowfishpro committed Sep 4, 2017
1 parent 564b226 commit f190d17
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions ModuleManager/IPatchProgress.cs
Expand Up @@ -17,6 +17,7 @@ public interface IPatchProgress
void Error(UrlDir.UrlConfig url, string message);
void Exception(string message, Exception exception);
void Exception(UrlDir.UrlConfig url, string message, Exception exception);
void NeedsUnsatisfiedRoot(string url, string name);
void NeedsUnsatisfiedNode(string url, string path);
void NeedsUnsatisfiedValue(string url, string path, string valName);
void ApplyingCopy(string url, string patchUrl);
Expand Down
2 changes: 1 addition & 1 deletion ModuleManager/MMPatchLoader.cs
Expand Up @@ -798,7 +798,7 @@ private void CheckNeeds()

if (!CheckNeeds(ref type))
{
progress.NeedsUnsatisfiedNode(currentMod.parent.url, currentMod.type);
progress.NeedsUnsatisfiedRoot(currentMod.parent.url, currentMod.type);
continue;
}

Expand Down
13 changes: 11 additions & 2 deletions ModuleManager/PatchProgress.cs
Expand Up @@ -16,6 +16,8 @@ public class PatchProgress : IPatchProgress

public int ExceptionCount { get; private set; } = 0;

public int NeedsUnsatisfiedRootCount { get; private set; } = 0;

public int NeedsUnsatisfiedCount { get; private set; } = 0;

public Dictionary<String, int> ErrorFiles { get; } = new Dictionary<string, int>();
Expand All @@ -27,7 +29,7 @@ public float ProgressFraction
get
{
if (TotalPatchCount > 0)
return (AppliedPatchCount + NeedsUnsatisfiedCount) / (float)TotalPatchCount;
return (AppliedPatchCount + NeedsUnsatisfiedRootCount) / (float)TotalPatchCount;
return 0;
}
}
Expand Down Expand Up @@ -65,9 +67,16 @@ public void PatchApplied()
AppliedPatchCount += 1;
}

public void NeedsUnsatisfiedRoot(string url, string name)
{
logger.Info($"Deleting root node in {url} subnode: {name} as it can't satisfy its NEEDS");
NeedsUnsatisfiedCount += 1;
NeedsUnsatisfiedRootCount += 1;
}

public void NeedsUnsatisfiedNode(string url, string path)
{
logger.Info($"Deleting Node in file {url} subnode: {path} as it can't satisfy its NEEDS");
logger.Info($"Deleting node in file {url} subnode: {path} as it can't satisfy its NEEDS");
NeedsUnsatisfiedCount += 1;
}

Expand Down

0 comments on commit f190d17

Please sign in to comment.