Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic task reducer #441

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Unicorn/ControlPanel/WebConsoleUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public static void SetTaskProgress(IProgressStatus progress, int taskNumber, int
if (totalTasks < 1) throw new ArgumentException("totalTasks must be 1 or more");
if (taskNumber > totalTasks) throw new ArgumentException("taskNumber was greater than the number of totalTasks!");

int start = (int)Math.Round(((taskNumber - 1) / (double)totalTasks) * 100d);
var taskReducer = totalTasks <= 100 ? 1 : totalTasks/100;

int start = (int)Math.Round(((taskNumber - taskReducer) / (double)totalTasks) * 100d);
int end = start + (int)Math.Round(0.5d + ((1d / totalTasks) * 100d));

SetRangeTaskProgress(progress, Math.Max(start, 0), Math.Min(end, 100), taskPercent);
Expand Down