Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting refactor #7404

Merged
merged 16 commits into from
Jun 13, 2024
Merged

Conversation

SchrodingersGat
Copy link
Member

@SchrodingersGat SchrodingersGat commented Jun 4, 2024

Adds helper functions for "get" and "set" for server-side settings.

  • Code reduction
  • Improves "cyclical" imports

@SchrodingersGat SchrodingersGat added this to the 0.16.0 milestone Jun 4, 2024
Copy link

netlify bot commented Jun 4, 2024

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

Name Link
🔨 Latest commit 25c1480
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/666a4ee5b5f2fd0008e1ecec

Copy link

codecov bot commented Jun 4, 2024

Codecov Report

Attention: Patch coverage is 71.69811% with 30 lines in your changes missing coverage. Please review.

Project coverage is 83.71%. Comparing base (713d2ac) to head (25c1480).
Report is 345 commits behind head on master.

Files with missing lines Patch % Lines
src/backend/InvenTree/InvenTree/forms.py 10.00% 9 Missing ⚠️
src/backend/InvenTree/common/settings.py 61.11% 7 Missing ⚠️
src/backend/InvenTree/InvenTree/tasks.py 66.66% 5 Missing ⚠️
src/backend/InvenTree/common/tests.py 70.00% 3 Missing ⚠️
src/backend/InvenTree/InvenTree/apps.py 33.33% 2 Missing ⚠️
src/backend/InvenTree/InvenTree/sso.py 50.00% 2 Missing ⚠️
src/backend/InvenTree/common/currency.py 83.33% 1 Missing ⚠️
src/backend/InvenTree/common/validators.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7404      +/-   ##
==========================================
- Coverage   83.86%   83.71%   -0.16%     
==========================================
  Files        1057     1058       +1     
  Lines       46408    46582     +174     
  Branches     1386     1386              
==========================================
+ Hits        38918    38994      +76     
- Misses       7129     7224      +95     
- Partials      361      364       +3     
Flag Coverage Δ
backend 85.05% <71.69%> (-0.10%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@matmair matmair left a comment

Choose a reason for hiding this comment

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

LGTM; should we add a pre-commit hook that ensures the new helpers are used / the model is not accessed directly?

@SchrodingersGat
Copy link
Member Author

@wolflu05 @matmair any insights into why CI might be failing here, on SQLITE / python 3.9, but works on 3.12?

@matmair
Copy link
Member

matmair commented Jun 12, 2024

Not really sure - looks like the DB is not cleaned

@SchrodingersGat
Copy link
Member Author

I cannot reproduce locally on a 3.9/sqlite setup...

@SchrodingersGat SchrodingersGat merged commit 129975a into inventree:master Jun 13, 2024
27 of 28 checks passed
@SchrodingersGat SchrodingersGat deleted the setting-refacot branch June 13, 2024 02:14
@SchrodingersGat
Copy link
Member Author

@matmair found the issue, a new setting was being created in the validator for a different setting.

@matmair
Copy link
Member

matmair commented Jun 13, 2024

That is a tricky one to find!

martonmiklos pushed a commit to martonmiklos/InvenTree that referenced this pull request Jun 24, 2024
* Add helper functions to set/get settings

* Refactor instances of get_setting

* UPdates

* Fix for task

* Add debug messages

- Work out what is going on in CI

* add more debug

- Cannot reproduce locally?

* More debug...

* Remove debug prints

* Add better debug msg

* Simplify unit test

* Increase timeout for plugin tests

* Update validator code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants