-
Notifications
You must be signed in to change notification settings - Fork 1
/
translator.py
41 lines (37 loc) · 1.51 KB
/
translator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
def get_wardrobe(data):
wardrobe_json = {}
for i in data:
if (
data[i]["product_classification"] == "wardrobe_body_extension"
or data[i]["product_classification"] == "wardrobe_body_base"
):
design_module_index = (
data[i]["customisation_details"]["design_module_index"] - 1
)
wardrobe_json[design_module_index] = {
"width": data[i]["customisation_details"]["width"],
"height": data[i]["customisation_details"]["height"],
}
return wardrobe_json
def get_components(data):
components_json = {}
for index, i in enumerate(data):
if data[i]["product_classification"] == "WARDROBE_SHELF_REGULAR":
design_module_index = (
data[i]["customisation_details"]["design_module_index"] - 1
)
components_json[index] = {
"body": design_module_index,
"component": "shelf",
"height": data[i]["customisation_details"]["assembly_position_Y"],
}
if data[i]["product_classification"] == "WARDROBE_DRAWER_SINGLE":
design_module_index = (
data[i]["customisation_details"]["design_module_index"] - 1
)
components_json[index] = {
"body": design_module_index,
"component": "drawer",
"height": data[i]["customisation_details"]["assembly_position_Y"],
}
return components_json