Skip to content

Commit

Permalink
Added oneGroupPerTable social distancing rule
Browse files Browse the repository at this point in the history
  • Loading branch information
mroloux committed Oct 19, 2020
1 parent bd792f8 commit 63985e4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions seatsio/charts/socialDistancingRulesetsRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def to_json(self, ruleset):
"maxGroupSize": ruleset.max_group_size,
"maxOccupancyAbsolute": ruleset.max_occupancy_absolute,
"maxOccupancyPercentage": ruleset.max_occupancy_percentage,
"oneGroupPerTable": ruleset.one_group_per_table,
"fixedGroupLayout": ruleset.fixed_group_layout,
"disabledSeats": ruleset.disabled_seats,
"enabledSeats": ruleset.enabled_seats,
Expand Down
13 changes: 8 additions & 5 deletions seatsio/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def createList(cls, param):
class SocialDistancingRuleset:
def __init__(self, name, number_of_disabled_seats_to_the_sides=0, disable_seats_in_front_and_behind=False,
number_of_disabled_aisle_seats=0, max_group_size=0, max_occupancy_absolute=0,
max_occupancy_percentage=0, fixed_group_layout=False,
max_occupancy_percentage=0, one_group_per_table=False, fixed_group_layout=False,
disabled_seats=[], enabled_seats=[], index=0):
self.name = name
self.number_of_disabled_seats_to_the_sides = number_of_disabled_seats_to_the_sides
Expand All @@ -106,22 +106,23 @@ def __init__(self, name, number_of_disabled_seats_to_the_sides=0, disable_seats_
self.max_group_size = max_group_size
self.max_occupancy_absolute = max_occupancy_absolute
self.max_occupancy_percentage = max_occupancy_percentage
self.one_group_per_table = one_group_per_table
self.fixed_group_layout = fixed_group_layout
self.disabled_seats = disabled_seats
self.enabled_seats = enabled_seats
self.index = index

@classmethod
def fixed(cls, name, disabled_seats=[], index=0):
return SocialDistancingRuleset(name, 0, False, 0, 0, 0, 0, True, disabled_seats, [], index)
return SocialDistancingRuleset(name, 0, False, 0, 0, 0, 0, False, True, disabled_seats, [], index)

@classmethod
def rule_based(cls, name, number_of_disabled_seats_to_the_sides=0, disable_seats_in_front_and_behind=False,
number_of_disabled_aisle_seats=0, max_group_size=0, max_occupancy_absolute=0,
max_occupancy_percentage=0, disabled_seats=[], enabled_seats=[], index=0):
max_occupancy_percentage=0, one_group_per_table=False, disabled_seats=[], enabled_seats=[], index=0):
return SocialDistancingRuleset(name, number_of_disabled_seats_to_the_sides, disable_seats_in_front_and_behind,
number_of_disabled_aisle_seats, max_group_size, max_occupancy_absolute,
max_occupancy_percentage, False, disabled_seats, enabled_seats, index)
max_occupancy_percentage, one_group_per_table, False, disabled_seats, enabled_seats, index)

def __eq__(self, other):
return self.name == other.name and \
Expand All @@ -131,6 +132,7 @@ def __eq__(self, other):
self.max_group_size == other.max_group_size and \
self.max_occupancy_absolute == other.max_occupancy_absolute and \
self.max_occupancy_percentage == other.max_occupancy_percentage and \
self.one_group_per_table == other.one_group_per_table and \
self.fixed_group_layout == other.fixed_group_layout and \
self.disabled_seats == other.disabled_seats and \
self.enabled_seats == other.enabled_seats and \
Expand All @@ -140,7 +142,7 @@ def __hash__(self):
return hash((self.name, self.number_of_disabled_seats_to_the_sides, self.disable_seats_in_front_and_behind,
self.number_of_disabled_aisle_seats,
self.max_group_size, self.max_occupancy_absolute, self.max_occupancy_percentage,
self.fixed_group_layout, self.disabled_seats, self.enabled_seats, self.index))
self.fixed_group_layout, self.one_group_per_table, self.disabled_seats, self.enabled_seats, self.index))

@classmethod
def create(cls, param):
Expand All @@ -153,6 +155,7 @@ def create(cls, param):
param.get('maxGroupSize'),
param.get('maxOccupancyAbsolute'),
param.get('maxOccupancyPercentage'),
param.get('oneGroupPerTable'),
param.get('fixedGroupLayout'),
param.get('disabledSeats'),
param.get('enabledSeats'),
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='seatsio',
version='v53.0.0',
version='v54.0.0',
description='The official Seats.io Python client library',
author='The seats.io dev team',
author_email='[email protected]',
Expand Down
2 changes: 2 additions & 0 deletions tests/charts/saveSocialDistancingRulesets.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def test(self):
max_group_size=1,
max_occupancy_absolute=10,
max_occupancy_percentage=0,
one_group_per_table=True,
fixed_group_layout=False,
disabled_seats=["A-1"],
enabled_seats=["A-2"],
Expand Down Expand Up @@ -53,6 +54,7 @@ def test_rule_based(self):
max_group_size=1,
max_occupancy_absolute=10,
max_occupancy_percentage=0,
one_group_per_table=True,
disabled_seats=["A-1"],
enabled_seats=["A-2"],
index=4
Expand Down

0 comments on commit 63985e4

Please sign in to comment.