Change failure behavior to match previous implementation

This commit is contained in:
Michael Bucari-Tovo 2022-05-24 08:57:11 -06:00
parent db1aa495ac
commit 43d6ea82cd
4 changed files with 24 additions and 22 deletions

View File

@ -131,7 +131,6 @@ namespace LibationWinForms.ProcessQueue
{
ProcessBookResult.Success => ProcessBookStatus.Completed,
ProcessBookResult.Cancelled => ProcessBookStatus.Cancelled,
ProcessBookResult.FailedRetry => ProcessBookStatus.Queued,
_ => ProcessBookStatus.Failed,
};
}

View File

@ -72,8 +72,8 @@ namespace LibationWinForms.ProcessQueue
Status = ProcessBookStatus.Cancelled;
break;
case ProcessBookResult.FailedRetry:
statusText = "Queued";
Status = ProcessBookStatus.Queued;
statusText = "Error, will retry later";
Status = ProcessBookStatus.Failed;
break;
case ProcessBookResult.FailedSkip:
statusText = "Error, Skippping";

View File

@ -51,9 +51,9 @@
this.logEntryColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.panel4 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.logCopyBtn = new System.Windows.Forms.Button();
this.clearLogBtn = new System.Windows.Forms.Button();
this.counterTimer = new System.Windows.Forms.Timer(this.components);
this.logCopyBtn = new System.Windows.Forms.Button();
this.statusStrip1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
@ -264,10 +264,21 @@
this.panel2.Size = new System.Drawing.Size(390, 25);
this.panel2.TabIndex = 1;
//
// logCopyBtn
//
this.logCopyBtn.Dock = System.Windows.Forms.DockStyle.Left;
this.logCopyBtn.Location = new System.Drawing.Point(0, 0);
this.logCopyBtn.Name = "logCopyBtn";
this.logCopyBtn.Size = new System.Drawing.Size(57, 23);
this.logCopyBtn.TabIndex = 1;
this.logCopyBtn.Text = "Copy";
this.logCopyBtn.UseVisualStyleBackColor = true;
this.logCopyBtn.Click += new System.EventHandler(this.LogCopyBtn_Click);
//
// clearLogBtn
//
this.clearLogBtn.Dock = System.Windows.Forms.DockStyle.Left;
this.clearLogBtn.Location = new System.Drawing.Point(0, 0);
this.clearLogBtn.Dock = System.Windows.Forms.DockStyle.Right;
this.clearLogBtn.Location = new System.Drawing.Point(328, 0);
this.clearLogBtn.Name = "clearLogBtn";
this.clearLogBtn.Size = new System.Drawing.Size(60, 23);
this.clearLogBtn.TabIndex = 0;
@ -280,17 +291,6 @@
this.counterTimer.Interval = 950;
this.counterTimer.Tick += new System.EventHandler(this.CounterTimer_Tick);
//
// logCopyBtn
//
this.logCopyBtn.Dock = System.Windows.Forms.DockStyle.Right;
this.logCopyBtn.Location = new System.Drawing.Point(331, 0);
this.logCopyBtn.Name = "logCopyBtn";
this.logCopyBtn.Size = new System.Drawing.Size(57, 23);
this.logCopyBtn.TabIndex = 1;
this.logCopyBtn.Text = "Copy";
this.logCopyBtn.UseVisualStyleBackColor = true;
this.logCopyBtn.Click += new System.EventHandler(this.LogCopyBtn_Click);
//
// ProcessQueueControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);

View File

@ -151,12 +151,15 @@ namespace LibationWinForms.ProcessQueue
var result = await nextBook.ProcessOneAsync();
if (result == ProcessBookResult.FailedRetry)
Queue.Enqueue(nextBook);
else if (result == ProcessBookResult.ValidationFail)
if (result == ProcessBookResult.ValidationFail)
Queue.ClearCurrent();
else if (result == ProcessBookResult.FailedAbort)
return;
Queue.ClearQueue();
else if (result == ProcessBookResult.FailedSkip)
{
nextBook.LibraryBook.Book.UserDefinedItem.BookStatus = DataLayer.LiberatedStatus.Error;
ApplicationServices.LibraryCommands.UpdateUserDefinedItem(nextBook.LibraryBook.Book);
}
}
Queue_CompletedCountChanged(this, 0);
counterTimer.Stop();
@ -176,7 +179,7 @@ namespace LibationWinForms.ProcessQueue
private void Queue_CompletedCountChanged(object sender, int e)
{
int errCount = Queue.Completed.Count(p => p.Result is ProcessBookResult.FailedAbort or ProcessBookResult.FailedSkip or ProcessBookResult.ValidationFail);
int errCount = Queue.Completed.Count(p => p.Result is ProcessBookResult.FailedAbort or ProcessBookResult.FailedSkip or ProcessBookResult.FailedRetry or ProcessBookResult.ValidationFail);
int completeCount = Queue.Completed.Count(p => p.Result is ProcessBookResult.Success);
ErrorCount = errCount;