== Writer Edits an Existing Chapter === Actor: **Writer** A writer edits the content of an already published chapter, for example to apply corrections or improvements. **1.** The writer navigates to their story and selects a chapter to edit. **2.** The system retrieves the current chapter content. {{{#!sql SELECT chapter_id, chapter_number, chapter_name, title, content, word_count, updated_at FROM CHAPTER WHERE chapter_id = 1 AND story_id = 1; }}} **3.** The writer modifies the chapter content and submits the changes. **4.** The system updates the chapter record with the new content and recalculates the word count. {{{#!sql UPDATE CHAPTER SET content = 'The ground trembled beneath the Crystal Mountains. Updated content here...', word_count = 3500, updated_at = CURRENT_TIMESTAMP WHERE chapter_id = 1 AND story_id = 1; }}} **5.** The system checks if there are any pending AI suggestions for this chapter that may now be outdated. {{{#!sql SELECT ai.suggestion_id, ai.original_text, ai.suggested_text FROM AI_SUGGESTION ai JOIN NEED_APPROVAL na ON ai.suggestion_id = na.suggestion_id WHERE na.chapter_id = 1 AND ai.accepted = FALSE; }}} **6.** The system notifies the writer of any pending unreviewed suggestions that may be affected by the edit. **7.** The system confirms the chapter was updated successfully and displays the updated version.