open-tacos icon indicating copy to clipboard operation
open-tacos copied to clipboard

Bulk adding new routes - ordering of routes gets scrambled and requires reordering

Open emilyg1709 opened this issue 10 months ago • 1 comments

Steps to Reproduce

  1. Add several routes to test area via bulk add
  2. Check sorting of routes - it'll be all over the place
  3. To get routes in order you have to manually sort climbs again when it would be best for them to stay in the order you added them in

Screenshots

Expected Behavior

Routes should be added to a crag in the order they were written in the bulk submit

Current Behavior

Routes get scrambled in seemingly random order?

Browser & version

<--- Example: Firefox 102.7.0esr --> Google Chrome

Operating system

<--- Example: MacOS 13.2.1 --> Windows

emilyg1709 avatar Jan 17 '25 22:01 emilyg1709

Tackling this one, seems like a good first issue for graphql changes.

Quick context off my initial read: The order of climbs within in area is handled by left_right_index, which is what the sort climbs feature updates, and what this app uses for display. By default, all climbs have a null sort index, hence it's basically undefined behavior and seemingly random.

IMO it's best resolved in the model/graphql layer directly -- for any operation that sends an array, we should assume that's the intended order.

Tangentially related detail is deciding order of incoming new climbs vs existing climbs. Right now adding a climb puts it first in the list. Again, that's not really intended behavior, we can go either way:

  • append -- new climbs after existing climbs (my preference but it breaks status quo so figured I'd mention it) OR
  • prepend -- new climbs before existing climbs

greghart avatar Feb 28 '25 06:02 greghart