Skip to content

Commit 71943d7

Browse files
committed
Fix new product action
1 parent bc71767 commit 71943d7

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

activity_browser/actions/activity/activity_new_process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def run(database_name: str):
6262
if not legacy_backend:
6363
# create reference product
6464
new_ref_prod_data = {
65-
"name": ref_product,
65+
"product": ref_product,
6666
"unit": unit,
6767
"location": location,
6868
"type": "product",

activity_browser/actions/activity/activity_new_product.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def run(activities: list[tuple | int | bd.Node], product_type: str = "product"):
6060

6161
# Create the new product
6262
new_prod_data = {
63-
"name": name,
63+
"product": name,
6464
"unit": unit,
6565
"location": location,
6666
"type": product_type,

tests/actions/test_activity_actions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ def test_activity_new(monkeypatch, basic_database):
6565
actions.ActivityNewProcess.run(basic_database.name)
6666

6767
assert len(basic_database) == 6
68-
assert len([p for p in basic_database if p["name"] == "new_process"]) == 1
69-
assert len([p for p in basic_database if p["name"] == "new_product"]) == 1
68+
assert len([p for p in basic_database if p["name"] == "new_process"]) == 2
69+
assert len([p for p in basic_database if p.get("product") == "new_product"]) == 1
7070

7171

7272
def test_process_open(basic_database):

0 commit comments

Comments
 (0)