From 6cd452018c4bf2511394868b1b8b1d051d94cc6c Mon Sep 17 00:00:00 2001 From: Nick Beckley Date: Fri, 3 Jul 2026 23:33:03 +0100 Subject: [PATCH] Phase 20F Fixed build project --- PlotLine/Services/OnboardingService.cs | 11 ++++++++++- PlotLine/Views/Onboarding/ScanReview.cshtml | 10 +++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/PlotLine/Services/OnboardingService.cs b/PlotLine/Services/OnboardingService.cs index 53fdfdd..92fd24c 100644 --- a/PlotLine/Services/OnboardingService.cs +++ b/PlotLine/Services/OnboardingService.cs @@ -247,7 +247,7 @@ public sealed class OnboardingService( await PublishBuildProgress(userId, preview.PreviewID, "Creating characters...", 60, progress); var result = await builds.BuildAsync(userId, request) - ?? throw new InvalidOperationException("The project structure could not be built. Check the review choices and try again."); + ?? throw new InvalidOperationException($"The project structure could not be built. Approved chapters: {request.Chapters.Count}, scenes: {request.Scenes.Count}, characters: {request.Characters.Count}. Return to review, save your selections, and try Build Project again."); await scanPreviews.SaveBuildResultAsync(userId, result); await PublishBuildProgress(userId, preview.PreviewID, "Finalising project...", 90, progress); await PublishBuildProgress(userId, preview.PreviewID, result.Message, 100, progress, result); @@ -415,6 +415,15 @@ public sealed class OnboardingService( var previewChapters = preview.Chapters.ToDictionary(chapter => chapter.TemporaryChapterKey, StringComparer.Ordinal); var previewScenes = preview.Scenes.ToDictionary(scene => scene.TemporarySceneKey, StringComparer.Ordinal); var includedChapterKeys = review.Chapters.Where(chapter => chapter.Include).Select(chapter => chapter.TemporaryChapterKey).ToHashSet(StringComparer.Ordinal); + if (includedChapterKeys.Count == 0) + { + throw new InvalidOperationException("Choose at least one chapter before continuing."); + } + + if (!review.Scenes.Any(scene => scene.Include && includedChapterKeys.Contains(scene.TemporaryChapterKey))) + { + throw new InvalidOperationException("Choose at least one scene before continuing."); + } if (review.Chapters.Where(chapter => chapter.Include).Any(chapter => string.IsNullOrWhiteSpace(chapter.Title))) { diff --git a/PlotLine/Views/Onboarding/ScanReview.cshtml b/PlotLine/Views/Onboarding/ScanReview.cshtml index 018ec3f..c295598 100644 --- a/PlotLine/Views/Onboarding/ScanReview.cshtml +++ b/PlotLine/Views/Onboarding/ScanReview.cshtml @@ -85,8 +85,8 @@