From 477318c1a6795791cd6e88d2beeffee0e8335266 Mon Sep 17 00:00:00 2001 From: anna-droid-beep <58149247+anna-droid-beep@users.noreply.github.com> Date: Wed, 11 Nov 2020 17:42:01 +0100 Subject: [PATCH] Fixes constructor for Director, Operator and Supervisor --- .../call_center/call_center.py | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/solutions/object_oriented_design/call_center/call_center.py b/solutions/object_oriented_design/call_center/call_center.py index 1d5e7bc6..dbd2b188 100644 --- a/solutions/object_oriented_design/call_center/call_center.py +++ b/solutions/object_oriented_design/call_center/call_center.py @@ -27,7 +27,9 @@ class Employee(metaclass=ABCMeta): def complete_call(self): self.call.state = CallState.COMPLETE - self.call_center.notify_call_completed(self.call) + call = self.call + self.call = None + self.call_center.notify_call_completed(call) @abstractmethod def escalate_call(self): @@ -42,28 +44,31 @@ class Employee(metaclass=ABCMeta): class Operator(Employee): - def __init__(self, employee_id, name): - super(Operator, self).__init__(employee_id, name, Rank.OPERATOR) + def __init__(self, employee_id, name, call_center): + super(Operator, self).__init__( + employee_id, name, Rank.OPERATOR, call_center) def escalate_call(self): - self.call.level = Rank.SUPERVISOR + self.call.rank = Rank.SUPERVISOR self._escalate_call() class Supervisor(Employee): - def __init__(self, employee_id, name): - super(Operator, self).__init__(employee_id, name, Rank.SUPERVISOR) + def __init__(self, employee_id, name, call_center): + super(Supervisor, self).__init__( + employee_id, name, Rank.SUPERVISOR, call_center) def escalate_call(self): - self.call.level = Rank.DIRECTOR + self.call.rank = Rank.DIRECTOR self._escalate_call() class Director(Employee): - def __init__(self, employee_id, name): - super(Operator, self).__init__(employee_id, name, Rank.DIRECTOR) + def __init__(self, employee_id, name, call_center): + super(Director, self).__init__( + employee_id, name, Rank.DIRECTOR, call_center) def escalate_call(self): raise NotImplementedError('Directors must be able to handle any call')