Part-DB / Part-DB-server

Part-DB is an Open source inventory management system for your electronic components
https://docs.part-db.de/
GNU Affero General Public License v3.0
891 stars 96 forks source link

Improve parameter parsing #583

Closed frank-f closed 5 months ago

frank-f commented 6 months ago

This will improve the following cases (example values):

-40°C ~ 125°C

This worked for LCSC only. Other providers needed "..." as range indicator and values with units could not be processed at all.

-40°C ~ 125°C @Tj

Extra info at the end stopped the range detection altogether, because the two "units" would not match. Extra info will now be saved to the "Text" column, making the units match and thus allowing the actual values to be saved as range.

22 µH

"µ" was missing in the unit detection regex

codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 62.06897% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 61.67%. Comparing base (9770ffa) to head (2b80ec8). Report is 2 commits behind head on master.

:exclamation: Current head 2b80ec8 differs from pull request most recent head 6f295ce. Consider uploading reports for the commit 6f295ce to get more accurate results

Files Patch % Lines
.../Services/InfoProviderSystem/DTOs/ParameterDTO.php 66.66% 9 Missing :warning:
...s/InfoProviderSystem/Providers/DigikeyProvider.php 0.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #583 +/- ## ============================================ + Coverage 61.65% 61.67% +0.01% - Complexity 5464 5469 +5 ============================================ Files 503 503 Lines 18231 18240 +9 ============================================ + Hits 11241 11249 +8 - Misses 6990 6991 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

frank-f commented 6 months ago

Got all tests to pass, so from my point of view my patch ready to be merged.

Let me know, if you'd like anything changed.

jbtronics commented 5 months ago

This seems like a good addition. I have added some tests for your code, so that changes dont break something unnoticed. Also fixed some edgecases.

Thank you