Skip to content

Specify R as ohms - #12065

Merged
SchrodingersGat merged 4 commits into
inventree:masterfrom
SchrodingersGat:r-unit
Jun 2, 2026
Merged

SchrodingersGat merged 4 commits into
inventree:masterfrom
SchrodingersGat:r-unit

Conversation

@SchrodingersGat

@SchrodingersGat SchrodingersGat commented Jun 2, 2026 •

Copy link
Copy Markdown
Member

@SchrodingersGat
SchrodingersGat requested a review from Copilot June 2, 2026 00:13
@netlify

netlify Bot commented Jun 2, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit b60ca35
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a1e6cb2164bee0008d742eb

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses incorrect parsing of RKM-style resistor values (e.g. 10R, 4R7) by ensuring R is interpreted as resistance (ohms) rather than being misinterpreted by the underlying Pint parser.

Changes:

  • Adds a custom unit mapping so R is treated as ohms in the unit registry.
  • Extends conversion unit tests to cover common R-delimiter resistance inputs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/backend/InvenTree/InvenTree/conversion.py Updates Pint unit registry setup to interpret R as ohms for RKM resistance parsing.
src/backend/InvenTree/InvenTree/tests.py Adds regression tests ensuring R-based resistance strings convert correctly to ohm.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Jun 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.84%. Comparing base (d3be030) to head (b60ca35).
⚠️ Report is 379 commits behind head on master.

❌ Your project status has failed because the head coverage (88.25%) is below the target coverage (90.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12065      +/-   ##
==========================================
- Coverage   91.43%   88.84%   -2.60%     
==========================================
  Files         975      975              
  Lines       52154    54490    +2336     
==========================================
+ Hits        47688    48409     +721     
- Misses       4466     6081    +1615     
Flag Coverage Δ
backend 90.45% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend Apps 88.25% <ø> (-3.52%) ⬇️
Backend General 93.38% <ø> (ø)
Frontend ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SchrodingersGat

Copy link
Copy Markdown
Member Author

@matmair LMK if you are happy with this change

@matmair matmair added breaking Indicates a major update or change which breaks compatibility refactor labels Jun 2, 2026
@matmair

matmair commented Jun 2, 2026

Copy link
Copy Markdown
Member

certainly is more in line with user expectations

@SchrodingersGat
SchrodingersGat merged commit 0f717e2 into inventree:master Jun 2, 2026
38 of 39 checks passed
@SchrodingersGat
SchrodingersGat deleted the r-unit branch June 2, 2026 06:16
martonmiklos pushed a commit to martonmiklos/InvenTree that referenced this pull request Jun 30, 2026
* Specify R as ohms

* Adjust comments
martonmiklos pushed a commit to martonmiklos/InvenTree that referenced this pull request Jun 30, 2026
* Specify R as ohms

* Adjust comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Indicates a major update or change which breaks compatibility refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error parsing RKM formatted resistance

3 participants