Skip to content
Snippets Groups Projects
Commit 803b9edf authored by Lorenzo Conti's avatar Lorenzo Conti
Browse files

Merge branch 'feature/add-type-to-export' into 'main'

Add AK types to json export

See merge request felix_bonn/akplanning!21
parents 1d0e2aaf da0e1a28
No related branches found
No related tags found
4 merge requests!262[WIP] compatibility with koma solver import/export,!261[WIP] compatibility with koma solver import/export,!260[WIP] import/export merge,!235Merge fork for interoperability of KoMa solver
...@@ -1075,6 +1075,7 @@ class AKSlot(models.Model): ...@@ -1075,6 +1075,7 @@ class AKSlot(models.Model):
"reso": self.ak.reso, "reso": self.ak.reso,
"duration_in_hours": float(self.duration), "duration_in_hours": float(self.duration),
"django_ak_id": self.ak.pk, "django_ak_id": self.ak.pk,
"types": list(self.ak.types.values_list("name", flat=True).order_by()),
}, },
} }
......
...@@ -143,6 +143,7 @@ class JSONExportTest(TestCase): ...@@ -143,6 +143,7 @@ class JSONExportTest(TestCase):
"reso", "reso",
"duration_in_hours", "duration_in_hours",
"django_ak_id", "django_ak_id",
"types",
}, },
f"{item} info keys not as expected", f"{item} info keys not as expected",
) )
...@@ -445,6 +446,10 @@ class JSONExportTest(TestCase): ...@@ -445,6 +446,10 @@ class JSONExportTest(TestCase):
) )
self.assertEqual(ak["info"]["description"], slot.ak.description) self.assertEqual(ak["info"]["description"], slot.ak.description)
self.assertEqual(ak["info"]["django_ak_id"], slot.ak.pk) self.assertEqual(ak["info"]["django_ak_id"], slot.ak.pk)
self.assertEqual(
ak["info"]["types"],
list(slot.ak.types.values_list("name", flat=True).order_by()),
)
def test_ak_room_constraints(self): def test_ak_room_constraints(self):
"""Test if AK room constraints are exported as expected.""" """Test if AK room constraints are exported as expected."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment