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.Success => ProcessBookStatus.Completed,
ProcessBookResult.Cancelled => ProcessBookStatus.Cancelled, ProcessBookResult.Cancelled => ProcessBookStatus.Cancelled,
ProcessBookResult.FailedRetry => ProcessBookStatus.Queued,
_ => ProcessBookStatus.Failed, _ => ProcessBookStatus.Failed,
}; };
} }

View File

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

View File

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

View File

@ -151,12 +151,15 @@ namespace LibationWinForms.ProcessQueue
var result = await nextBook.ProcessOneAsync(); var result = await nextBook.ProcessOneAsync();
if (result == ProcessBookResult.FailedRetry) if (result == ProcessBookResult.ValidationFail)
Queue.Enqueue(nextBook);
else if (result == ProcessBookResult.ValidationFail)
Queue.ClearCurrent(); Queue.ClearCurrent();
else if (result == ProcessBookResult.FailedAbort) 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); Queue_CompletedCountChanged(this, 0);
counterTimer.Stop(); counterTimer.Stop();
@ -176,7 +179,7 @@ namespace LibationWinForms.ProcessQueue
private void Queue_CompletedCountChanged(object sender, int e) 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); int completeCount = Queue.Completed.Count(p => p.Result is ProcessBookResult.Success);
ErrorCount = errCount; ErrorCount = errCount;