From a7972a898a4aa9e353048ca15acda75912e35b2f Mon Sep 17 00:00:00 2001 From: camilogs Date: Sat, 12 Aug 2023 20:52:39 -0500 Subject: [PATCH] chore: Se refactoriza on_change_calls para mejor legibilidad --- prospect_trace.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/prospect_trace.py b/prospect_trace.py index 351bc1d..77880c5 100644 --- a/prospect_trace.py +++ b/prospect_trace.py @@ -42,12 +42,16 @@ class ProspectTrace(DeactivableMixin, ModelSQL, ModelView): last_call = self.calls[-1] self.current_interest = last_call.interest - if len(self.calls) > 1: - last_call.call_type = CallTypes.get_call_types()[1][0] + already_exist_a_call = len(self.calls) > 1 + if already_exist_a_call: + followup_call_type = CallTypes.get_call_types()[1][0] + last_call.call_type = followup_call_type else: - last_call.call_type = CallTypes.get_call_types()[0][0] + first_call_type = CallTypes.get_call_types()[0][0] + last_call.call_type = first_call_type - if len(self.pending_calls) >= 1: + there_is_a_pending_call = len(self.pending_calls) >= 1 + if there_is_a_pending_call: self.pending_calls = None self.state = 'open'