fix(story): tutorial section is_finished derives from viewer tutorial_step

Section 0 (prologue) has no chapter rows server-side — the prologue is
hardcoded client-side in Wizard/Prologue.cs — so the chapter-completion
rollup always emitted is_finished=false. The client uses that flag to
derive IsTutorialReplay; with it false, AreaSelectUI.OnTouchChapterListTutorial
blocks every chapter switch and the default focus (last visible chapter)
becomes the only confirmable one, matching the reported "all 3 greyed out,
only the 3rd playable" symptom on replay.

Override sectionFinished for id=0 with viewer.MissionData.TutorialState >= 100,
matching prod traffic_prod_626_story.ndjson btn_story_tutorial.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-05-28 22:01:50 -04:00
parent 22c01ed11a
commit 261ce67cee
2 changed files with 85 additions and 0 deletions

View File

@@ -192,6 +192,17 @@ public class StoryService : IStoryService
var allProgress = await _viewer.GetProgressForChaptersAsync(
viewerId, allChapters.Select(c => c.StoryId));
// Tutorial section (id=0) has no chapter rows server-side — the prologue is hardcoded
// client-side in Wizard/Prologue.cs. Derive its is_finished from viewer.tutorial_step
// instead (matches prod traffic_prod_626_story.ndjson btn_story_tutorial). The client
// uses is_finished to flip IsTutorialReplay, which is what re-enables chapter switching
// in AreaSelectUI.OnTouchChapterListTutorial when the user re-visits the prologue.
const int TutorialEndStep = 100;
var tutorialState = await _db.Viewers
.Where(v => v.Id == viewerId)
.Select(v => v.MissionData.TutorialState)
.FirstOrDefaultAsync();
// Index chapters by (sectionId, charaId) for O(1) lookup in the rollup loop.
var chaptersBySectionChara = allChapters
.GroupBy(c => (c.SectionId, c.CharaId))
@@ -253,6 +264,8 @@ public class StoryService : IStoryService
}
}
if (s.Id == 0) sectionFinished = tutorialState >= TutorialEndStep;
if (!sectionFinished) worldComplete = false;
worldDto.SectionList.Add(new SectionEntry
{