Implemented the Floor Plans Occupancy scene dropdown fix.
Changed: [CoreModels.cs (line 308)](C:/Source/PlotLine/PlotLine/Models/CoreModels.cs:308) now maps book/chapter metadata onto Scene for ordering/labels. [CoreServices.cs (line 7818)](C:/Source/PlotLine/PlotLine/Services/CoreServices.cs:7818) now orders occupancy scenes by book, chapter, scene, title and labels them like: Book 1, Chapter 1.00, Scene 1.00: Arrival at the House Added and applied [082_FloorPlanOccupancySceneOrdering.sql](C:/Source/PlotLine/PlotLine/Sql/082_FloorPlanOccupancySceneOrdering.sql) to update Scene_ListByFloorPlan. Verified: Database query for The Calendar House now returns Chapter 1 scenes in order, then Chapter 2 scenes, etc. dotnet build PlotLine.slnx passes with 0 warnings and 0 errors. No schema changes, no occupancy model changes, no floor plan rendering changes, and no transition changes. Previous/Next should follow the corrected order because it uses the same ordered scene list in the dropdown.
This commit is contained in:
parent
13c97db5a0
commit
f4a455f70b
@ -308,6 +308,15 @@ public sealed class Scene
|
||||
{
|
||||
public int SceneID { get; set; }
|
||||
public int ChapterID { get; set; }
|
||||
public int BookID { get; set; }
|
||||
public int BookNumber { get; set; }
|
||||
public int BookSortOrder { get; set; }
|
||||
public string? BookTitle { get; set; }
|
||||
public string? BookSubtitle { get; set; }
|
||||
public string BookDisplayTitle => BookTitleFormatter.DisplayTitle(BookTitle, BookSubtitle);
|
||||
public decimal ChapterNumber { get; set; }
|
||||
public int ChapterSortOrder { get; set; }
|
||||
public string? ChapterTitle { get; set; }
|
||||
public decimal SceneNumber { get; set; }
|
||||
public string SceneTitle { get; set; } = string.Empty;
|
||||
public string? Summary { get; set; }
|
||||
|
||||
@ -7818,14 +7818,19 @@ public sealed class FloorPlanService(
|
||||
BlockTypeOptions = FloorPlanBlockTypes.All.Select(x => new SelectListItem(BlockTypeLabel(x), x)).ToList(),
|
||||
TransitionTypeOptions = FloorPlanTransitionTypes.All.Select(x => new SelectListItem(x, x)).ToList(),
|
||||
OccupancyScenes = occupancyScenes
|
||||
.OrderBy(x => x.StartDateTime ?? DateTime.MaxValue)
|
||||
.OrderBy(x => x.BookSortOrder)
|
||||
.ThenBy(x => x.BookNumber)
|
||||
.ThenBy(x => x.BookDisplayTitle)
|
||||
.ThenBy(x => x.ChapterSortOrder)
|
||||
.ThenBy(x => x.ChapterNumber)
|
||||
.ThenBy(x => x.SceneNumber)
|
||||
.ThenBy(x => x.SortOrder)
|
||||
.ThenBy(x => x.SceneTitle)
|
||||
.Select(x => new FloorPlanOccupancySceneViewModel
|
||||
{
|
||||
SceneID = x.SceneID,
|
||||
InitialFloorPlanFloorID = x.InitialFloorPlanFloorID,
|
||||
Label = $"Scene {x.SceneNumber}: {x.SceneTitle}"
|
||||
Label = OccupancySceneLabel(x)
|
||||
})
|
||||
.ToList(),
|
||||
OccupancyTokens = occupancyRows
|
||||
@ -7967,6 +7972,15 @@ public sealed class FloorPlanService(
|
||||
private static string OccupantName(SceneFloorPlanOccupancy row)
|
||||
=> row.CharacterName ?? row.AssetName ?? "Occupant";
|
||||
|
||||
private static string OccupancySceneLabel(Scene scene)
|
||||
{
|
||||
var chapter = $"Chapter {scene.ChapterNumber:0.00}";
|
||||
var sceneLabel = $"Scene {scene.SceneNumber:0.00}: {scene.SceneTitle}";
|
||||
return scene.BookNumber > 0
|
||||
? $"Book {scene.BookNumber}, {chapter}, {sceneLabel}"
|
||||
: $"{chapter}, {sceneLabel}";
|
||||
}
|
||||
|
||||
private static bool IsVisibleEntranceTransition(string? transitionType)
|
||||
{
|
||||
var normalized = (transitionType ?? string.Empty)
|
||||
|
||||
69
PlotLine/Sql/082_FloorPlanOccupancySceneOrdering.sql
Normal file
69
PlotLine/Sql/082_FloorPlanOccupancySceneOrdering.sql
Normal file
@ -0,0 +1,69 @@
|
||||
SET ANSI_NULLS ON;
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.Scene_ListByFloorPlan
|
||||
@FloorPlanID int
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
s.SceneID,
|
||||
s.ChapterID,
|
||||
c.BookID,
|
||||
b.BookNumber,
|
||||
b.SortOrder AS BookSortOrder,
|
||||
b.BookTitle,
|
||||
b.Subtitle AS BookSubtitle,
|
||||
c.ChapterNumber,
|
||||
c.SortOrder AS ChapterSortOrder,
|
||||
c.ChapterTitle,
|
||||
s.SceneNumber,
|
||||
s.SceneTitle,
|
||||
s.Summary,
|
||||
s.POVCharacterID,
|
||||
s.PrimaryLocationID,
|
||||
s.FloorPlanID,
|
||||
s.InitialFloorPlanFloorID,
|
||||
s.SortOrder,
|
||||
s.TimeModeID,
|
||||
tm.TimeModeName,
|
||||
s.StartDateTime,
|
||||
s.EndDateTime,
|
||||
s.DurationAmount,
|
||||
s.DurationUnitID,
|
||||
du.DurationUnitName,
|
||||
s.RelativeTimeText,
|
||||
s.TimeConfidenceID,
|
||||
tc.TimeConfidenceName,
|
||||
s.ScenePurposeNotes,
|
||||
s.SceneOutcomeNotes,
|
||||
s.RevisionStatusID,
|
||||
rs.StatusName AS RevisionStatusName,
|
||||
s.CreatedDate,
|
||||
s.UpdatedDate,
|
||||
s.IsArchived
|
||||
FROM dbo.Scenes s
|
||||
INNER JOIN dbo.Chapters c ON c.ChapterID = s.ChapterID
|
||||
INNER JOIN dbo.Books b ON b.BookID = c.BookID
|
||||
INNER JOIN dbo.TimeModes tm ON tm.TimeModeID = s.TimeModeID
|
||||
INNER JOIN dbo.TimeConfidences tc ON tc.TimeConfidenceID = s.TimeConfidenceID
|
||||
INNER JOIN dbo.RevisionStatuses rs ON rs.RevisionStatusID = s.RevisionStatusID
|
||||
LEFT JOIN dbo.DurationUnits du ON du.DurationUnitID = s.DurationUnitID
|
||||
WHERE s.FloorPlanID = @FloorPlanID
|
||||
AND s.IsArchived = 0
|
||||
AND c.IsArchived = 0
|
||||
AND b.IsArchived = 0
|
||||
ORDER BY
|
||||
b.SortOrder,
|
||||
b.BookNumber,
|
||||
b.BookTitle,
|
||||
c.SortOrder,
|
||||
c.ChapterNumber,
|
||||
s.SceneNumber,
|
||||
s.SortOrder,
|
||||
s.SceneTitle;
|
||||
END;
|
||||
GO
|
||||
Loading…
x
Reference in New Issue
Block a user