OpenRailAssociation / osrd

An open source web application for railway infrastructure design, capacity analysis, timetabling and simulation
https://osrd.fr
443 stars 40 forks source link

Sort rolling stocks #3993

Open anisometropie opened 1 year ago

anisometropie commented 1 year ago

Description and goal

Rolling stocks Previously were sorted like this :

filteredRollingStockListNew = filteredRollingStockListNew.sort((a, b) => {
      if (a.reference && b.reference && a.reference !== b.reference) {
        return a.name.localeCompare(b.name) && a.reference.localeCompare(b.reference);
      }
      return a.name.localeCompare(b.name);
    });

the && operator probably doesn’t do what’s intended for this function.

—> we can either sort by name or by metadata.reference, (or a one then the other?) but some elements are at the beginning (missing name or reference).

(since https://github.com/DGEXSolutions/osrd/pull/3820, left sorted like the back is sending us.)

Acceptance criteria

Rolling stocks correctly sorted.

axrolld commented 3 months ago

This will be converted into a proper feature, but it needs a bit of refinement from users.