OpenEnergyDashboard / OED

Open Energy Dashboard (OED)
Mozilla Public License 2.0
82 stars 307 forks source link

how items are sorted #1188

Closed huss closed 2 weeks ago

huss commented 7 months ago

Is your feature request related to a problem? Please describe.

src/client/app/redux/api/unitsApi.ts sorts by ‘accent’ and other places that do localeCompare(). src/client/app/redux/selectors/uiSelectors.ts and other uses sortBy() without this. May be other places that sort that should be looked at.

Describe the solution you'd like

OED should be consistent. Determine what localeCompare might be adding and use as appropriate. One thought is to use a standard callback something like: sortByIdentifier(entityA,entityB) => localeCompare(...)

Describe alternatives you've considered

The difference probably isn't too important so leave as is until fixed.

Additional context

None

aduques commented 1 month ago

Can @gyordong and I work on this issue?

huss commented 1 month ago

@aduques & @gyordong I've assigned the issue to @aduques since that is all GItHub would let me do. Please let me know if you need any information.

gyordong commented 1 month ago

From what we can tell, unitsApi.ts directly affects units, and since units can be made with custom names, the sortBy() function needs to be used with accent sensitivity to account for different languages. On the other hand, uiSelectors.ts seems to use standard developer options, which wouldn't need to discriminate by accent. Are we on the right track? Would the goal be to make it to modify all sortby() functions to use some derivative of localeCompare() for consistency?

huss commented 1 month ago

For the record, I talked with these developers about this.