Deleting the chapter 1 of a 2-chapter work leaves the sole remaining chapter as position: 2

Description

Steps to reproduce

We’re going to post a work with two chapters and then delete the first chapter:

  1. Log in

  2. Post > New Work

  3. Fill in required fields and, on the way down, check "This work has multiple chapters." You don't have to do anything special in this field.

  4. Press "Post"

  5. Follow the "Add Chapter" link

  6. Fill in required fields

  7. Press "Post"

  8. Follow the "Previous Chapter" link to return to Chapter 1

  9. Follow the "Edit Chapter" link

  10. Press "Delete Chapter" and press "OK" to confirm deletion

What happens

Many things! But I'm reasonably sure they all relate to what's going on at the database level, which is the Chapter object's position attribute remains position: 2. Here, let me show you:

Now, the practical, user-facing consequences of this are:

  • The title of the remaining chapter says "Chapter 2"

  • If you follow the "Edit Chapter" link on the chapter, you will see it listed as Chapter Number 2 of ? on the form, and the chapter text will appear in the Chapter Text field

  • If you follow the "Edit" link to edit the work, you will see the chapter's text in the Work Text field, which usually only happens for Chapter 1 of a work (until Chapter 2 is posted, then the text is no longer there)

What should happen

  • The Chapter should be position: 1

  • The chapter title should be “Chapter 1”

  • Following the "Edit Chapter" link should show the chapter as Chapter Number 1 of ?

Notes

Possibly related to somehow?

Also, if you post a new chapter, the new one ends up as Chapter 1, both in terms of title and position.

Assignee

Unassigned

Reporter

Sarken

Roadmap

Works

Priority

Medium

Affects versions

Fix versions

None

Components

BackEnd

Difficulty

Medium

Milestone

Internal 0.9
Configure