PlotDirector/PlotLine/Sql/082_FloorPlanOccupancySceneOrdering.sql
Nick Beckley f4a455f70b 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.
2026-06-22 13:24:46 +01:00

70 lines
1.8 KiB
Transact-SQL

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