-
Notifications
You must be signed in to change notification settings - Fork 5
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
Slamd update 3 dichtebasierte angaben beim blending #125
base: main
Are you sure you want to change the base?
Slamd update 3 dichtebasierte angaben beim blending #125
Conversation
…y a required field in base material form
…owder, removed mentions in backend logic and test cases
…r volume based blending logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ein Gedanke noch: Wie viel Aufwand wäre es, mit find+replace/refactor tools die Variablen "density", die die specific gravity enthalten, in "gravity" umzubennen?
|
||
list_of_normalized_ratios_lists = RatioParser.create_list_of_normalized_ratio_lists(all_ratios_as_string, | ||
RATIO_DELIMITER) | ||
|
||
print(list_of_normalized_ratios_lists) | ||
print(base_materials_as_dict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug print statements können raus
@@ -46,7 +46,7 @@ def submit_blending(): | |||
def add_min_max_entry(material_type, count): | |||
data = json.loads(request.data) | |||
min_max_form, complete = BlendedMaterialsService.create_min_max_form(material_type, count, data) | |||
body = {'template': render_template('min_max_form.html', min_max_form=min_max_form, complete=complete)} | |||
body = {'template': render_template('min_max_form.html', material_type=material_type, count=count, min_max_form=min_max_form, complete=complete)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verständnisfrage: Wo werden material_type und count im min_max_form template verwendet?
@@ -27,3 +27,20 @@ def _to_normalized_ratio_list(cls, ratio, delimiter): | |||
ratio_list = [string_to_number(piece) for piece in pieces] | |||
sum_ratio_list = sum(ratio_list) | |||
return [ratio / sum_ratio_list for ratio in ratio_list] | |||
|
|||
@classmethod | |||
def weight_to_density_ratios(cls, normalized_ratios, base_materials): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diese Funktion nimmt Volumen-Ratios, wandelt sie durch Multiplikation mit Dichte in Massen-Ratios um, und renormalisiert dann diese, richtig?
Wäre also ein Name wie "volume_to_weight_ratios" nicht passender? (Und ggf. "weight_ratio" als variablenname besser als "density ratio")
dto = all_materials[1] | ||
assert dto.name == 'test powder' | ||
assert dto.type == 'Powder' | ||
assert dto.all_properties == 'Fe₂O₃ (m%): 23.3, Specific gravity: 12, test prop: test value' | ||
assert dto.all_properties == 'Fe₂O₃ (m%): 23.3, Density (t/m³): 3, test prop: test value' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warum ist es hier Density und nicht Specific Gravity?
@@ -21,6 +21,7 @@ def mock_query_by_type(input): | |||
|
|||
html = response.data.decode('utf-8') | |||
assert 'Blended base materials' in html | |||
assert 'Blended base materials' in html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplikat
@@ -204,9 +182,10 @@ def mock_save(material_type, material): | |||
if material_type == 'aggregates': | |||
nonlocal mock_save_called_with_first_blended_material | |||
nonlocal mock_save_called_with_second_blended_material | |||
if material.name == 'test blend 1-0.4/0.4/0.2': | |||
print(material.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug print statement
base_materials_dict = create_test_base_materials_dict() | ||
weights_to_density_ratios = RatioParser.weight_to_density_ratios(normalized_ratios, base_materials_dict) | ||
|
||
assert weights_to_density_ratios == [[0.36, 0.64], [0.46, 0.54], [0.57, 0.43]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline am ende der datei
|
||
assert result.ctx == 'blended materials' | ||
assert mock_delete_by_type_and_uuid_called_with == ( | ||
'powder', 'uuid to delete') | ||
|
||
# | ||
def test_weights_to_density_ratio(monkeypatch): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dieser Test testet, ob diese Funktion inhaltlich korrekt ist, aber ich habe keinen Test gesehen, der testet, ob sie im korrekten Kontext aufgerufen wird. Würde ich noch hinzufügen. Für so einen Test würde ich save_blended_materials aufrufen, weight_to_density_ratios mocken, und checken dass der mock einmal aufgerufen wird
No description provided.