Add default_unit field to space for property calculations #4334
+286
−68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
default_unitfield to Space model for use in property calculations when an ingredient has no unitmissing_conversiondetails (notmissing_unit) when default unit exists but conversion is missing -- just like for a configured unit without conversion_try_calculate_propertyhelper methodChanges
Backend
default_unitForeignKey to Space (nullable, SET_NULL)UnitSerializerearlier in file to use inSpaceSerializer_try_calculate_propertyto reduce code duplicationFrontend
Test Plan
missing_unit)missing_conversiondetails)Partially fixes #4009 (I did not touch the display logic)
Notes
I am neither a Vue nor a Python developer. So I used an LLM to help me with the implementation, reviewed and revised the results. But still I don't know what I don't know so please review the PR carefully.