From d3a4401d14d3db6c91fc3c4ec9071d379ca45e9c Mon Sep 17 00:00:00 2001 From: Elia el Lazkani Date: Sun, 24 Nov 2024 21:35:45 +0100 Subject: [PATCH] chore(): Cleaning up a bit of unneeded code --- src/entities/person.py | 9 +-------- src/entities/room.py | 19 ++++--------------- src/flow/room.py | 4 +++- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/entities/person.py b/src/entities/person.py index 5a5ebd3..ee0b4e6 100644 --- a/src/entities/person.py +++ b/src/entities/person.py @@ -11,11 +11,4 @@ class Person: Person entity initializer """ self.name = name - self.uuid = None - self.create() - - def create(self): - if not self.uuid: - self.uuid = uuid.uuid1() - - return self + self.uuid = uuid.uuid1() diff --git a/src/entities/room.py b/src/entities/room.py index 279804e..8222c3e 100644 --- a/src/entities/room.py +++ b/src/entities/room.py @@ -8,27 +8,16 @@ class Room: Room entity """ - def __init__(self, name, card_type="fibonacci"): + def __init__(self, name: str, creator: uuid.UUID, card_type="fibonacci"): """ Room entity initializer """ self.name = name - self.uuid = None + self.creator = creator + self.uuid = uuid.uuid1() self.attendant = [] self.card_type = card_type - self.cards = None - self.create() - - def create(self): - """ - Method to create a new room object - """ - if not self.uuid: - self.uuid = uuid.uuid1() - - self.assign_cards() - - return self + self.cards = self.assign_cards(card_type) def add_person(self, person: uuid.UUID): """ diff --git a/src/flow/room.py b/src/flow/room.py index 17b2247..9e5f1ff 100644 --- a/src/flow/room.py +++ b/src/flow/room.py @@ -11,6 +11,8 @@ def create_room(person: uuid.UUID, name: str = None): """ if not name: name = random.choice(ROOM_NAMES) - r = Room(name) + + r = Room(name=name, creator=person) r.add_person(person) + return r