Closed maksz42 closed 2 years ago
Thanks for the PR. The original idea of the project was to parse the data in backend, normalize them and present them in uniform form. Therefore, if your original intention is to fix problem of the fields 'Maximum Clamping Voltage' and 'Circuit Protection/TVS' I suggest a "better" fix: adding them to this list: https://github.com/yaqwsx/jlcparts/blob/17adb09b9d9b3289dead846d93f94c2c360dd81b/jlcparts/datatables.py#L66
Overall, I like the idea of the fallback solution (string compare) behaving more reasonable.
TVS was just an example. I think we can't parse/normalize every single property so at least the default sorting could be better.
I think we can - it is just laborious (we already support an arbitrary field format with multiple values in various units).
Some values are messed up (ordered alphabetically), for example, 'Maximum Clamping Voltage' of 'Circuit Protection/TVS': I tried
localeCompare
with{numeric: true}
and it was better but still not perfect: I found"@discoveryjs/natural-compare"
package and it seems to work just fine: