@@ -151,7 +151,7 @@ CancellationToken cancellationToken
151
151
{
152
152
await hubContext . NotifyDraftApplyProgress (
153
153
sfProjectId ,
154
- new DraftApplyState { State = $ "Retrieving draft for { Canon . BookIdToEnglishName ( book ) } ." }
154
+ new DraftApplyState { State = $ "Retrieving draft for { book } ." }
155
155
) ;
156
156
int bookNum = Canon . BookIdToNumber ( book ) ;
157
157
@@ -212,11 +212,12 @@ await hubContext.NotifyDraftApplyProgress(
212
212
// If the usfm is invalid, skip this book
213
213
if ( string . IsNullOrWhiteSpace ( usfm ) )
214
214
{
215
+ result . Failures . Add ( book ) ;
215
216
await hubContext . NotifyDraftApplyProgress (
216
217
sfProjectId ,
217
218
new DraftApplyState
218
219
{
219
- State = $ "No book number for { Canon . BookNumberToEnglishName ( bookNum ) } .",
220
+ State = $ "No draft available for { Canon . BookNumberToId ( bookNum ) } .",
220
221
}
221
222
) ;
222
223
break ;
@@ -231,7 +232,7 @@ await hubContext.NotifyDraftApplyProgress(
231
232
new DraftApplyState
232
233
{
233
234
State =
234
- $ "Could not retrieve draft for { Canon . BookNumberToEnglishName ( bookNum ) } .",
235
+ $ "Could not retrieve a valid draft for { Canon . BookNumberToId ( bookNum ) } .",
235
236
}
236
237
) ;
237
238
@@ -265,7 +266,7 @@ await hubContext.NotifyDraftApplyProgress(
265
266
new DraftApplyState
266
267
{
267
268
State =
268
- $ "Could not retrieve draft for { Canon . BookNumberToEnglishName ( bookNum ) } { chapterNum } .",
269
+ $ "Could not retrieve draft for { Canon . BookNumberToId ( bookNum ) } { chapterNum } .",
269
270
}
270
271
) ;
271
272
continue ;
@@ -284,8 +285,7 @@ await hubContext.NotifyDraftApplyProgress(
284
285
sfProjectId ,
285
286
new DraftApplyState
286
287
{
287
- State =
288
- $ "Could not retrieve draft for { Canon . BookNumberToEnglishName ( bookNum ) } { chapterNum } .",
288
+ State = $ "Could not retrieve draft for { Canon . BookNumberToId ( bookNum ) } { chapterNum } .",
289
289
}
290
290
) ;
291
291
continue ;
@@ -327,7 +327,7 @@ await hubContext.NotifyDraftApplyProgress(
327
327
bool successful = false ;
328
328
try
329
329
{
330
- // Being the transaction
330
+ // Begin the transaction
331
331
connection . BeginTransaction ( ) ;
332
332
333
333
// Begin a transaction, and update the project
@@ -413,16 +413,12 @@ await projectService.UpdatePermissionsAsync(
413
413
if ( textIndex == - 1 )
414
414
{
415
415
string bookId = Canon . BookNumberToId ( bookNum ) ;
416
- if ( result . Failures . LastOrDefault ( ) != bookId )
416
+ if ( result . Failures . Add ( bookId ) )
417
417
{
418
- // Only list the book failure once
419
- result . Failures . Add ( bookId ) ;
418
+ // Only notify the book failure once per book
420
419
await hubContext . NotifyDraftApplyProgress (
421
420
sfProjectId ,
422
- new DraftApplyState
423
- {
424
- State = $ "Could not save draft for { Canon . BookNumberToEnglishName ( bookNum ) } .",
425
- }
421
+ new DraftApplyState { State = $ "Could not save draft for { Canon . BookNumberToId ( bookNum ) } ." }
426
422
) ;
427
423
}
428
424
@@ -441,16 +437,12 @@ await hubContext.NotifyDraftApplyProgress(
441
437
}
442
438
443
439
string bookId = Canon . BookNumberToId ( bookNum ) ;
444
- if ( result . Failures . LastOrDefault ( ) != bookId )
440
+ if ( result . Failures . Add ( bookId ) )
445
441
{
446
- // Only list the book failure once
447
- result . Failures . Add ( bookId ) ;
442
+ // Only notify the book failure once per book
448
443
await hubContext . NotifyDraftApplyProgress (
449
444
sfProjectId ,
450
- new DraftApplyState
451
- {
452
- State = $ "Could not save draft for { Canon . BookNumberToEnglishName ( bookNum ) } .",
453
- }
445
+ new DraftApplyState { State = $ "Could not save draft for { Canon . BookNumberToId ( bookNum ) } ." }
454
446
) ;
455
447
}
456
448
@@ -468,8 +460,7 @@ await hubContext.NotifyDraftApplyProgress(
468
460
sfProjectId ,
469
461
new DraftApplyState
470
462
{
471
- State =
472
- $ "Could not save draft for { Canon . BookNumberToEnglishName ( bookNum ) } { chapterDelta . Number } .",
463
+ State = $ "Could not save draft for { Canon . BookNumberToId ( bookNum ) } { chapterDelta . Number } .",
473
464
}
474
465
) ;
475
466
continue ;
@@ -499,8 +490,7 @@ await hubContext.NotifyDraftApplyProgress(
499
490
sfProjectId ,
500
491
new DraftApplyState
501
492
{
502
- State =
503
- $ "Could not save draft for { Canon . BookNumberToEnglishName ( bookNum ) } { chapterDelta . Number } .",
493
+ State = $ "Could not save draft for { Canon . BookNumberToId ( bookNum ) } { chapterDelta . Number } .",
504
494
}
505
495
) ;
506
496
continue ;
@@ -523,7 +513,7 @@ await hubContext.NotifyDraftApplyProgress(
523
513
sfProjectId ,
524
514
new DraftApplyState
525
515
{
526
- State = $ "Updating { Canon . BookNumberToEnglishName ( bookNum ) } { chapterDelta . Number } .",
516
+ State = $ "Updating { Canon . BookNumberToId ( bookNum ) } { chapterDelta . Number } .",
527
517
}
528
518
) ;
529
519
}
@@ -535,7 +525,7 @@ await hubContext.NotifyDraftApplyProgress(
535
525
sfProjectId ,
536
526
new DraftApplyState
537
527
{
538
- State = $ "Creating { Canon . BookNumberToEnglishName ( bookNum ) } { chapterDelta . Number } .",
528
+ State = $ "Creating { Canon . BookNumberToId ( bookNum ) } { chapterDelta . Number } .",
539
529
}
540
530
) ;
541
531
}
0 commit comments