From b2cfcd08faef9eb98bfd79172d72a44e68bfc05d Mon Sep 17 00:00:00 2001 From: Nick Beckley Date: Fri, 12 Jun 2026 20:43:19 +0100 Subject: [PATCH] Phase 9A cleanup --- PlotLine/Services/CoreServices.cs | 52 ++++++++----------- PlotLine/ViewModels/CoreViewModels.cs | 2 - PlotLine/Views/Scenes/_SceneInspector.cshtml | 4 -- PlotLine/Views/Writer/Chapter.cshtml | 2 +- PlotLine/Views/Writer/Index.cshtml | 11 ---- .../Views/Writer/_WriterSceneQueue.cshtml | 2 +- 6 files changed, 24 insertions(+), 49 deletions(-) diff --git a/PlotLine/Services/CoreServices.cs b/PlotLine/Services/CoreServices.cs index ddfd14c..c657f9c 100644 --- a/PlotLine/Services/CoreServices.cs +++ b/PlotLine/Services/CoreServices.cs @@ -1159,9 +1159,6 @@ public sealed class SceneService( model.StorageUsage = model.SceneID == 0 ? null : await storage.GetSceneStorageUsageAsync(model.SceneID); model.SceneNoteTypeOptions = ChapterService.ToSelectList(noteTypes, x => x.SceneNoteTypeID, x => x.TypeName); model.SceneAttachmentTypeOptions = ChapterService.ToSelectList(attachmentTypes, x => x.SceneAttachmentTypeID, x => x.TypeName); - model.DraftStatusOptions = DraftStatuses() - .Select(x => new SelectListItem(x, x, string.Equals(x, model.Workflow.DraftStatus, StringComparison.OrdinalIgnoreCase))) - .ToList(); model.PlotLineOptions = ToOptionalSelectList(plotLines, x => x.PlotLineID, x => x.PlotLineName); model.PlotThreadOptions = ToOptionalSelectList(plotThreads, x => x.PlotThreadID, x => $"{x.PlotLineName}: {x.ThreadTitle}"); model.PlotLineEventOptions = plotLines; @@ -1307,18 +1304,6 @@ public sealed class SceneService( return model; } - internal static IReadOnlyList DraftStatuses() => - [ - "Planned", - "Ready To Draft", - "Drafting", - "Drafted", - "Revising", - "Polishing", - "Complete", - "On Hold" - ]; - private static IReadOnlyList ToOptionalSelectList(IEnumerable rows, Func value, Func text) => rows.Select(x => new SelectListItem(text(x), value(x).ToString())).ToList(); @@ -3153,7 +3138,6 @@ public sealed class WriterWorkspaceService( ProjectOptions = projectRows.Select(x => new SelectListItem(x.ProjectName, x.ProjectID.ToString(), x.ProjectID == projectId)).ToList(), WriteNext = await GetDashboardScenesAsync(projectIds, "WriteNext"), ContinueWriting = await GetDashboardScenesAsync(projectIds, "ContinueWriting"), - NeedsAttention = await GetDashboardScenesAsync(projectIds, "NeedsAttention"), RevisionQueue = await GetDashboardScenesAsync(projectIds, "RevisionQueue"), PolishingQueue = await GetDashboardScenesAsync(projectIds, "PolishingQueue"), StoryHealthReminders = await GetDashboardRemindersAsync(projectIds) @@ -3212,21 +3196,29 @@ public sealed class WriterWorkspaceService( RisksOrConcerns = model.RisksOrConcerns }); - public Task SaveSceneWorkflowAsync(SceneWorkflowEditViewModel model) => writerWorkspace.SaveWorkflowAsync(new SceneWorkflow + public async Task SaveSceneWorkflowAsync(SceneWorkflowEditViewModel model) { - SceneID = model.SceneID, - DraftStatus = model.DraftStatus, - EstimatedWordCount = model.EstimatedWordCount, - ActualWordCount = model.ActualWordCount, - DraftedDate = model.DraftedDate, - LastWorkedOn = model.LastWorkedOn, - ReadyForDraft = model.ReadyForDraft, - ReadyForRevision = model.ReadyForRevision, - ReadyForPolish = model.ReadyForPolish, - IsBlocked = model.IsBlocked, - BlockedReason = model.BlockedReason, - Priority = model.Priority - }); + var existing = await writerWorkspace.GetWorkflowAsync(model.SceneID); + var priority = model.Priority.HasValue + ? Math.Clamp(model.Priority.Value, 1, 10) + : (int?)null; + + await writerWorkspace.SaveWorkflowAsync(new SceneWorkflow + { + SceneID = model.SceneID, + DraftStatus = existing.DraftStatus, + EstimatedWordCount = model.EstimatedWordCount, + ActualWordCount = model.ActualWordCount, + DraftedDate = model.DraftedDate, + LastWorkedOn = model.LastWorkedOn, + ReadyForDraft = existing.ReadyForDraft, + ReadyForRevision = existing.ReadyForRevision, + ReadyForPolish = existing.ReadyForPolish, + IsBlocked = model.IsBlocked, + BlockedReason = model.BlockedReason, + Priority = priority + }); + } public Task SaveNoteAsync(SceneNoteEditViewModel model) => writerWorkspace.SaveNoteAsync(new SceneNote { diff --git a/PlotLine/ViewModels/CoreViewModels.cs b/PlotLine/ViewModels/CoreViewModels.cs index cab9792..64d92f0 100644 --- a/PlotLine/ViewModels/CoreViewModels.cs +++ b/PlotLine/ViewModels/CoreViewModels.cs @@ -217,7 +217,6 @@ public sealed class SceneEditViewModel public SceneAttachmentEditViewModel NewAttachment { get; set; } = new(); public IReadOnlyList SceneNoteTypeOptions { get; set; } = []; public IReadOnlyList SceneAttachmentTypeOptions { get; set; } = []; - public IReadOnlyList DraftStatusOptions { get; set; } = []; public StorageUsage? StorageUsage { get; set; } public int? ReturnProjectID { get; set; } @@ -317,7 +316,6 @@ public sealed class WriterDashboardViewModel public IReadOnlyList ProjectOptions { get; set; } = []; public IReadOnlyList WriteNext { get; set; } = []; public IReadOnlyList ContinueWriting { get; set; } = []; - public IReadOnlyList NeedsAttention { get; set; } = []; public IReadOnlyList RevisionQueue { get; set; } = []; public IReadOnlyList PolishingQueue { get; set; } = []; public IReadOnlyList StoryHealthReminders { get; set; } = []; diff --git a/PlotLine/Views/Scenes/_SceneInspector.cshtml b/PlotLine/Views/Scenes/_SceneInspector.cshtml index 7fe5e41..0e2700d 100644 --- a/PlotLine/Views/Scenes/_SceneInspector.cshtml +++ b/PlotLine/Views/Scenes/_SceneInspector.cshtml @@ -1208,10 +1208,6 @@
- - - -
diff --git a/PlotLine/Views/Writer/Chapter.cshtml b/PlotLine/Views/Writer/Chapter.cshtml index 38f6639..85bef68 100644 --- a/PlotLine/Views/Writer/Chapter.cshtml +++ b/PlotLine/Views/Writer/Chapter.cshtml @@ -77,7 +77,7 @@

Scene @scene.SceneNumber: @scene.SceneTitle

- @(string.IsNullOrWhiteSpace(scene.RevisionStatusName) ? scene.DraftStatus : scene.RevisionStatusName) + @scene.RevisionStatusName
@if (scene.Priority.HasValue) { Priority @scene.Priority } diff --git a/PlotLine/Views/Writer/Index.cshtml b/PlotLine/Views/Writer/Index.cshtml index f7cab4a..8caf2cb 100644 --- a/PlotLine/Views/Writer/Index.cshtml +++ b/PlotLine/Views/Writer/Index.cshtml @@ -40,17 +40,6 @@ -
-
-
-

Practical blockers

-

Needs Attention

-
- @Model.NeedsAttention.Count scenes -
- -
-
diff --git a/PlotLine/Views/Writer/_WriterSceneQueue.cshtml b/PlotLine/Views/Writer/_WriterSceneQueue.cshtml index 103e8e8..1b8ae22 100644 --- a/PlotLine/Views/Writer/_WriterSceneQueue.cshtml +++ b/PlotLine/Views/Writer/_WriterSceneQueue.cshtml @@ -15,7 +15,7 @@ else @scene.BookTitle / Chapter @scene.ChapterNumber

Scene @scene.SceneNumber: @scene.SceneTitle

- @(string.IsNullOrWhiteSpace(scene.RevisionStatusName) ? scene.DraftStatus : scene.RevisionStatusName) + @scene.RevisionStatusName
@if (!string.IsNullOrWhiteSpace(scene.Summary)) {