diff --git a/OF DL/Program.cs b/OF DL/Program.cs index da787ea..dc40a14 100644 --- a/OF DL/Program.cs +++ b/OF DL/Program.cs @@ -967,16 +967,22 @@ public class Program Console.WriteLine(); await AnsiConsole.Progress() - .Columns(new ProgressBarColumn(), new PercentageColumn(), new TaskDescriptionColumn()) + .Columns(new ProgressBarColumn(), new PercentageColumn(), new TaskDescriptionColumn { Alignment = Justify.Left }) .StartAsync(RunUpdateAsync); async Task RunUpdateAsync(ProgressContext context) { - ProgressTask updateTask = context.AddTask($"Updating User Info for '{users.Count}' users", true, users.Count); + ProgressTask updateTask = null; + + int maxUsernameLength = users.Keys.Max(s => s.Length); foreach ((string username, long userId) in users) { - updateTask.Description = $"Updating '{username}'"; + string description = $"Updating '{username}'".PadRight(11 + maxUsernameLength); + double prevValue = updateTask?.Value ?? 0; + + updateTask = context.AddTask(description, true, users.Count); + updateTask.Value = prevValue; using (LogContext.PushProperty("Username", username)) using (LogContext.PushProperty("UserId", userId)) @@ -986,20 +992,23 @@ public class Program Log.Information("Updating User Info for for: {Username:l}"); User? user_info = await m_ApiHelper.GetUserInfo(username, $"/users/{username}"); await dbHelper.UpdateUserInfo(username, user_info); + + updateTask.Description = $"{description} - COMPLETE"; } catch (Exception ex) { Log.Warning(ex, "Failed to update User Info for: {Username:l}"); AnsiConsole.Markup($"[red]Failed to update User Info for '{username}'\n[/]"); + + updateTask.Description = $"{description} - FAILED: {ex.Message}"; } finally { updateTask.Increment(1); + updateTask.StopTask(); } } } - - updateTask.StopTask(); } }