diff --git a/seatsio/domain.py b/seatsio/domain.py index 3e6484b..5b85653 100644 --- a/seatsio/domain.py +++ b/seatsio/domain.py @@ -261,6 +261,8 @@ def __init__(self, item_data): self.is_companion_seat = item_data.get("isCompanionSeat") self.has_restricted_view = item_data.get("hasRestrictedView") self.zone = item_data.get("zone") + self.floor = item_data.get("floor") + class EventReport: diff --git a/tests/reports/charts/testChartReports.py b/tests/reports/charts/testChartReports.py index cfeb5ad..d7e4a1c 100644 --- a/tests/reports/charts/testChartReports.py +++ b/tests/reports/charts/testChartReports.py @@ -41,6 +41,7 @@ def test_reportItemProperties(self, update_chart, get_report): assert_that(report_item.is_accessible).is_not_none() assert_that(report_item.is_companion_seat).is_not_none() assert_that(report_item.has_restricted_view).is_not_none() + assert_that(report_item.floor).is_none() @parameterized.expand([ [ @@ -110,6 +111,29 @@ def testByLabel(self, update_chart, get_report): assert_that(report.get("A-1")).has_size(1) assert_that(report.get("A-2")).has_size(1) + @parameterized.expand([ + [ + lambda instance, chart_key: {}, + lambda instance, chart_key: instance.client.charts.reports.by_label(chart_key=chart_key) + ], + [ + lambda instance, chart_key: instance.create_draft_chart(chart_key), + lambda instance, chart_key: instance.client.charts.reports.by_label(chart_key=chart_key, version='draft') + ] + ]) + def testByLabelWithFloors(self, update_chart, get_report): + chart_key = self.create_test_chart_with_floors() + update_chart(self, chart_key) + + report = get_report(self, chart_key) + + assert_that(report).is_instance(ChartReport) + assert_that(report.get("S1-A-1")[0].floor).is_equal_to({"name": "1", "displayName": "Floor 1"}) + assert_that(report.get("S1-A-2")[0].floor).is_equal_to({"name": "1", "displayName": "Floor 1"}) + assert_that(report.get("S2-B-1")[0].floor).is_equal_to({"name": "2", "displayName": "Floor 2"}) + assert_that(report.get("S2-B-2")[0].floor).is_equal_to({"name": "2", "displayName": "Floor 2"}) + + @parameterized.expand([ [ lambda instance, chart_key: {}, @@ -131,6 +155,29 @@ def testByObjectType(self, update_chart, get_report): assert_that(report.get("seat")).has_size(32) assert_that(report.get("generalAdmission")).has_size(2) + @parameterized.expand([ + [ + lambda instance, chart_key: {}, + lambda instance, chart_key: instance.client.charts.reports.by_object_type(chart_key=chart_key) + ], + [ + lambda instance, chart_key: instance.create_draft_chart(chart_key), + lambda instance, chart_key: instance.client.charts.reports.by_object_type(chart_key=chart_key, + version='draft') + ] + ]) + def testByObjectTypeWithFloors(self, update_chart, get_report): + chart_key = self.create_test_chart_with_floors() + update_chart(self, chart_key) + + report = get_report(self, chart_key) + + assert_that(report).is_instance(ChartReport) + assert_that(report.get("seat")[0].floor).is_equal_to({"name": "1", "displayName": "Floor 1"}) + assert_that(report.get("seat")[1].floor).is_equal_to({"name": "1", "displayName": "Floor 1"}) + assert_that(report.get("seat")[2].floor).is_equal_to({"name": "2", "displayName": "Floor 2"}) + assert_that(report.get("seat")[3].floor).is_equal_to({"name": "2", "displayName": "Floor 2"}) + @parameterized.expand([ [ lambda instance, chart_key: {}, @@ -240,6 +287,30 @@ def testByZone(self, update_chart, get_report): assert_that(report.get("finishline")).has_size(2865) assert_that(report.get("NO_ZONE")).has_size(0) + + @parameterized.expand([ + [ + lambda instance, chart_key: {}, + lambda instance, chart_key: instance.client.charts.reports.by_section(chart_key=chart_key) + ], + [ + lambda instance, chart_key: instance.create_draft_chart(chart_key), + lambda instance, chart_key: instance.client.charts.reports.by_section(chart_key=chart_key, + version='draft') + ] + ]) + def testBySectionWithFloors(self, update_chart, get_report): + chart_key = self.create_test_chart_with_floors() + update_chart(self, chart_key) + + report = get_report(self, chart_key) + + assert_that(report).is_instance(ChartReport) + assert_that(report.get("S1")[0].floor).is_equal_to({"name": "1", "displayName": "Floor 1"}) + assert_that(report.get("S1")[1].floor).is_equal_to({"name": "1", "displayName": "Floor 1"}) + assert_that(report.get("S2")[0].floor).is_equal_to({"name": "2", "displayName": "Floor 2"}) + assert_that(report.get("S2")[1].floor).is_equal_to({"name": "2", "displayName": "Floor 2"}) + def create_draft_chart(self, chart_key): self.client.events.create(chart_key) self.client.charts.update(chart_key, "Foo") diff --git a/tests/sampleChartWithFloors.json b/tests/sampleChartWithFloors.json index e4679c1..9817137 100644 --- a/tests/sampleChartWithFloors.json +++ b/tests/sampleChartWithFloors.json @@ -1,7 +1,7 @@ { - "name": "chartWithFloors", + "name": "Multi-floor test", "tablesLabelCounter": 1, - "uuidCounter": 43, + "uuidCounter": 13, "categories": { "list": [ { @@ -12,12 +12,12 @@ }, { "label": "CatB", - "color": "#CD254A", + "color": "#662C4E", "accessible": false, "key": 2 } ], - "maxCategoryKey": 2 + "maxCategoryKey": 1 }, "zones": { "list": [] @@ -25,14 +25,14 @@ "rowSpacing": 14, "rowChairSpacing": 5, "colorScheme": "light", - "version": 21, + "version": 22, "venueType": "WITH_SECTIONS_AND_FLOORS", "sectionScaleFactor": 100, "referenceChartVisible": true, "subChartFloors": [ { - "height": 173.11, - "width": 268.67, + "height": 63.11, + "width": 1294.22, "tables": [], "texts": [], "imageObjects": [], @@ -49,16 +49,16 @@ "y": 1 }, { - "x": 238.78, + "x": 77.67, "y": 1 }, { - "x": 238.78, - "y": 147.67 + "x": 77.67, + "y": 62.11 }, { "x": 1, - "y": 147.67 + "y": 62.11 } ], "label": "S1", @@ -68,8 +68,8 @@ "labelVerticalOffset": 0, "labelRotationAngle": 0, "uuid": "uuid2", - "categoryLabel": null, - "categoryKey": null, + "categoryLabel": "Foo", + "categoryKey": 1, "topLeft": { "x": 0, "y": 0 @@ -83,8 +83,8 @@ "skippedCharacters": [] }, "subChart": { - "height": 149, - "width": 240, + "height": 64, + "width": 79, "tables": [], "texts": [], "imageObjects": [], @@ -109,156 +109,37 @@ }, "seats": [ { - "x": 42.22, - "y": 105, + "x": 21.11, + "y": 29.78, "label": "1", "displayLabel": null, - "categoryLabel": "CatB", + "categoryLabel": "Foo", "categoryAccessible": false, - "categoryKey": 2, + "categoryKey": 1, "restrictedView": false, "viewFromYourSeatImage": null, "accessible": false, "companionSeat": false, "semiAmbulatorySeat": false, "disabledBySocialDistancingRules": false, - "uuid": "uuid5", + "uuid": "uuid3", "published": true }, { - "x": 63.22, - "y": 105, + "x": 42.11, + "y": 29.78, "label": "2", "displayLabel": null, - "categoryLabel": "CatB", - "categoryAccessible": false, - "categoryKey": 2, - "restrictedView": false, - "viewFromYourSeatImage": null, - "accessible": false, - "companionSeat": false, - "semiAmbulatorySeat": false, - "disabledBySocialDistancingRules": false, - "uuid": "uuid6", - "published": true - }, - { - "x": 84.22, - "y": 105, - "label": "3", - "displayLabel": null, - "categoryLabel": "CatB", - "categoryAccessible": false, - "categoryKey": 2, - "restrictedView": false, - "viewFromYourSeatImage": null, - "accessible": false, - "companionSeat": false, - "semiAmbulatorySeat": false, - "disabledBySocialDistancingRules": false, - "uuid": "uuid7", - "published": true - }, - { - "x": 105.22, - "y": 105, - "label": "4", - "displayLabel": null, - "categoryLabel": "CatB", - "categoryAccessible": false, - "categoryKey": 2, - "restrictedView": false, - "viewFromYourSeatImage": null, - "accessible": false, - "companionSeat": false, - "semiAmbulatorySeat": false, - "disabledBySocialDistancingRules": false, - "uuid": "uuid8", - "published": true - }, - { - "x": 126.22, - "y": 105, - "label": "5", - "displayLabel": null, - "categoryLabel": "CatB", - "categoryAccessible": false, - "categoryKey": 2, - "restrictedView": false, - "viewFromYourSeatImage": null, - "accessible": false, - "companionSeat": false, - "semiAmbulatorySeat": false, - "disabledBySocialDistancingRules": false, - "uuid": "uuid9", - "published": true - }, - { - "x": 147.22, - "y": 105, - "label": "6", - "displayLabel": null, - "categoryLabel": "CatB", - "categoryAccessible": false, - "categoryKey": 2, - "restrictedView": false, - "viewFromYourSeatImage": null, - "accessible": false, - "companionSeat": false, - "semiAmbulatorySeat": false, - "disabledBySocialDistancingRules": false, - "uuid": "uuid10", - "published": true - }, - { - "x": 168.22, - "y": 105, - "label": "7", - "displayLabel": null, - "categoryLabel": "CatB", - "categoryAccessible": false, - "categoryKey": 2, - "restrictedView": false, - "viewFromYourSeatImage": null, - "accessible": false, - "companionSeat": false, - "semiAmbulatorySeat": false, - "disabledBySocialDistancingRules": false, - "uuid": "uuid11", - "published": true - }, - { - "x": 189.22, - "y": 105, - "label": "8", - "displayLabel": null, - "categoryLabel": "CatB", + "categoryLabel": "Foo", "categoryAccessible": false, - "categoryKey": 2, - "restrictedView": false, - "viewFromYourSeatImage": null, - "accessible": false, - "companionSeat": false, - "semiAmbulatorySeat": false, - "disabledBySocialDistancingRules": false, - "uuid": "uuid12", - "published": true - }, - { - "x": 210.22, - "y": 105, - "label": "9", - "displayLabel": null, - "categoryLabel": "CatB", - "categoryAccessible": false, - "categoryKey": 2, + "categoryKey": 1, "restrictedView": false, "viewFromYourSeatImage": null, "accessible": false, "companionSeat": false, "semiAmbulatorySeat": false, "disabledBySocialDistancingRules": false, - "uuid": "uuid13", + "uuid": "uuid4", "published": true } ], @@ -267,7 +148,7 @@ "verticalRowLabelDirection": "BASELINE_LEFT", "displayObjectType": "row", "objectType": "row", - "uuid": "uuid15", + "uuid": "uuid6", "points": null, "smooth": false, "smoothness": 50, @@ -277,33 +158,7 @@ } ], "shapes": [], - "booths": [ - { - "label": "1", - "displayLabel": null, - "sectionLabel": null, - "sectionDisplayedLabel": null, - "objectLabeling": { - "algoName": "SimpleNumbers", - "prefix": "", - "startAtIndex": 0, - "skippedCharacters": [] - }, - "center": { - "x": 47.78, - "y": 48.33 - }, - "width": 50, - "height": 50, - "rotationAngle": 0, - "categoryLabel": "CatA", - "categoryKey": 1, - "objectType": "booth", - "uuid": "uuid4", - "published": true, - "entrance": null - } - ], + "booths": [], "icons": [], "generalAdmissionAreas": [] }, @@ -315,15 +170,15 @@ "backgroundImage": null, "referenceChart": null, "snapOffset": { - "x": 3, - "y": 2.11 + "x": 2.33, + "y": 2.33 }, "floorDisplayName": "Floor 1", "floorName": "1" }, { - "height": 173.11, - "width": 268.67, + "height": 63.11, + "width": 1294.22, "tables": [], "texts": [], "imageObjects": [], @@ -336,20 +191,20 @@ { "points": [ { - "x": 29.89, - "y": 25.44 + "x": 1243.22, + "y": 13.22 }, { - "x": 267.67, - "y": 25.44 + "x": 1293.22, + "y": 13.22 }, { - "x": 267.67, - "y": 172.11 + "x": 1293.22, + "y": 53.22 }, { - "x": 29.89, - "y": 172.11 + "x": 1243.22, + "y": 53.22 } ], "label": "S2", @@ -358,12 +213,12 @@ "labelHorizontalOffset": 0, "labelVerticalOffset": 0, "labelRotationAngle": 0, - "uuid": "uuid31", - "categoryLabel": null, - "categoryKey": null, + "uuid": "uuid9", + "categoryLabel": "Bar", + "categoryKey": 2, "topLeft": { - "x": 28.89, - "y": 24.44 + "x": 1242.22, + "y": 12.22 }, "entrance": null, "viewFromYourSeatImage": null, @@ -374,14 +229,14 @@ "skippedCharacters": [] }, "subChart": { - "height": 149, - "width": 240, + "height": 42, + "width": 52, "tables": [], "texts": [], "imageObjects": [], "rows": [ { - "label": "A", + "label": "B", "displayLabel": null, "sectionLabel": null, "sectionDisplayedLabel": null, @@ -400,11 +255,11 @@ }, "seats": [ { - "x": 42.22, - "y": 105, + "x": 16, + "y": 19.89, "label": "1", "displayLabel": null, - "categoryLabel": "CatB", + "categoryLabel": "Foo", "categoryAccessible": false, "categoryKey": 2, "restrictedView": false, @@ -413,88 +268,15 @@ "companionSeat": false, "semiAmbulatorySeat": false, "disabledBySocialDistancingRules": false, - "entrance": null, - "uuid": "uuid34", + "uuid": "uuid10", "published": true }, { - "x": 63.22, - "y": 105, + "x": 37, + "y": 19.89, "label": "2", "displayLabel": null, - "categoryLabel": "CatB", - "categoryAccessible": false, - "categoryKey": 2, - "restrictedView": false, - "viewFromYourSeatImage": null, - "accessible": false, - "companionSeat": false, - "semiAmbulatorySeat": false, - "disabledBySocialDistancingRules": false, - "entrance": null, - "uuid": "uuid35", - "published": true - }, - { - "x": 84.22, - "y": 105, - "label": "3", - "displayLabel": null, - "categoryLabel": "CatB", - "categoryAccessible": false, - "categoryKey": 2, - "restrictedView": false, - "viewFromYourSeatImage": null, - "accessible": false, - "companionSeat": false, - "semiAmbulatorySeat": false, - "disabledBySocialDistancingRules": false, - "entrance": null, - "uuid": "uuid36", - "published": true - }, - { - "x": 105.22, - "y": 105, - "label": "4", - "displayLabel": null, - "categoryLabel": "CatB", - "categoryAccessible": false, - "categoryKey": 2, - "restrictedView": false, - "viewFromYourSeatImage": null, - "accessible": false, - "companionSeat": false, - "semiAmbulatorySeat": false, - "disabledBySocialDistancingRules": false, - "entrance": null, - "uuid": "uuid37", - "published": true - }, - { - "x": 126.22, - "y": 105, - "label": "5", - "displayLabel": null, - "categoryLabel": "CatB", - "categoryAccessible": false, - "categoryKey": 2, - "restrictedView": false, - "viewFromYourSeatImage": null, - "accessible": false, - "companionSeat": false, - "semiAmbulatorySeat": false, - "disabledBySocialDistancingRules": false, - "entrance": null, - "uuid": "uuid38", - "published": true - }, - { - "x": 147.22, - "y": 105, - "label": "6", - "displayLabel": null, - "categoryLabel": "CatB", + "categoryLabel": "Foo", "categoryAccessible": false, "categoryKey": 2, "restrictedView": false, @@ -503,62 +285,7 @@ "companionSeat": false, "semiAmbulatorySeat": false, "disabledBySocialDistancingRules": false, - "entrance": null, - "uuid": "uuid39", - "published": true - }, - { - "x": 168.22, - "y": 105, - "label": "7", - "displayLabel": null, - "categoryLabel": "CatB", - "categoryAccessible": false, - "categoryKey": 2, - "restrictedView": false, - "viewFromYourSeatImage": null, - "accessible": false, - "companionSeat": false, - "semiAmbulatorySeat": false, - "disabledBySocialDistancingRules": false, - "entrance": null, - "uuid": "uuid40", - "published": true - }, - { - "x": 189.22, - "y": 105, - "label": "8", - "displayLabel": null, - "categoryLabel": "CatB", - "categoryAccessible": false, - "categoryKey": 2, - "restrictedView": false, - "viewFromYourSeatImage": null, - "accessible": false, - "companionSeat": false, - "semiAmbulatorySeat": false, - "disabledBySocialDistancingRules": false, - "entrance": null, - "uuid": "uuid41", - "published": true - }, - { - "x": 210.22, - "y": 105, - "label": "9", - "displayLabel": null, - "categoryLabel": "CatB", - "categoryAccessible": false, - "categoryKey": 2, - "restrictedView": false, - "viewFromYourSeatImage": null, - "accessible": false, - "companionSeat": false, - "semiAmbulatorySeat": false, - "disabledBySocialDistancingRules": false, - "entrance": null, - "uuid": "uuid42", + "uuid": "uuid11", "published": true } ], @@ -567,7 +294,7 @@ "verticalRowLabelDirection": "BASELINE_LEFT", "displayObjectType": "row", "objectType": "row", - "uuid": "uuid33", + "uuid": "uuid13", "points": null, "smooth": false, "smoothness": 50, @@ -577,33 +304,7 @@ } ], "shapes": [], - "booths": [ - { - "label": "1", - "displayLabel": null, - "sectionLabel": null, - "sectionDisplayedLabel": null, - "objectLabeling": { - "algoName": "SimpleNumbers", - "prefix": "", - "startAtIndex": 0, - "skippedCharacters": [] - }, - "center": { - "x": 47.78, - "y": 48.33 - }, - "width": 50, - "height": 50, - "rotationAngle": 0, - "categoryLabel": "CatA", - "categoryKey": 1, - "objectType": "booth", - "uuid": "uuid43", - "published": true, - "entrance": null - } - ], + "booths": [], "icons": [], "generalAdmissionAreas": [] }, @@ -615,8 +316,8 @@ "backgroundImage": null, "referenceChart": null, "snapOffset": { - "x": 3, - "y": 2.11 + "x": 2.33, + "y": 2.33 }, "floorDisplayName": "Floor 2", "floorName": "2" @@ -624,4 +325,3 @@ ], "multiFloorView": "isometric" } -