Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code improvements dec 2024 #87

Merged
merged 14 commits into from
Dec 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor Pipedrive Integration and Enhance Worker Model
- Introduced a new Pipedrive client structure, including models for Activity, Deal, Note, Organization, Person, Stage, and User, improving the organization and clarity of the Pipedrive integration.
- Removed the outdated pipedrive.py file to streamline the codebase.
- Updated the Worker model to correctly reference activities from the post metadata, enhancing the accuracy of account management logic.
- Improved the __all__ exports in the Pipedrive module to include newly added models and ensure proper encapsulation.

These changes enhance the maintainability and functionality of the Pipedrive integration while improving the Worker model's accuracy in handling activities.
ElemarJR committed Dec 30, 2024
commit ad6bcd156aa5df525f34e3f793ebb52198b157ac
Original file line number Diff line number Diff line change
@@ -53,6 +53,13 @@ def from_wordpress_post(post: WorkerPost, worker_client_rels: Dict[int, List[int
if photo_url == '':
photo_url = None

# Obtém a lista de atividades do campo meta ou acf
atividades = post.meta.get('atividade', []) if post.meta else []
if isinstance(atividades, str):
atividades = [int(atividades)]
elif isinstance(atividades, list):
atividades = [int(a) for a in atividades if a]

return Worker(
id=post.id,
name=post.title.rendered,
@@ -63,6 +70,6 @@ def from_wordpress_post(post: WorkerPost, worker_client_rels: Dict[int, List[int
link=post.link,
profile=post.content.rendered,
has_profile=(post.content.rendered is not None) and len(post.content.rendered) > 0,
is_account_manager=28 in post.atividade,
is_account_manager=28 in atividades,
clients=worker_client_rels.get(post.id, [])
)
15 changes: 8 additions & 7 deletions backend/models/src/omni_models/syntactic/__init__.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,8 @@
)

from omni_models.syntactic.pipedrive import (
Activity, Client, Deal, Note, Organization, Person, Pipedrive, Stage, User,
Activity, Organization, Deal, Note, Person, Pipedrive, Stage, User,
ContactInfo, PictureInfo,
)

from omni_models.syntactic.todoist import (Collaborator, Folder, Project, Task, Todoist,)
@@ -17,10 +18,10 @@

__all__ = [
'Acf', 'Activity', 'Appointment', 'Billing', 'Budget',
'Client', 'Collaborator', 'CommentStatus', 'Content',
'Deal', 'EventDetail', 'Everhour', 'Excerpt', 'Folder',
'GUID', 'Note', 'Organization', 'Person', 'PingStatus',
'Pipedrive', 'Post', 'PostStatus', 'PostType', 'Project',
'Rate', 'Stage', 'Task', 'Title', 'Todoist', 'User',
'Wordpress', 'logger'
'Client', 'Collaborator', 'CommentStatus', 'ContactInfo',
'Content', 'Deal', 'EventDetail', 'Everhour', 'Excerpt',
'Folder', 'GUID', 'Note', 'Organization', 'Person',
'PictureInfo', 'PingStatus', 'Pipedrive', 'Post',
'PostStatus', 'PostType', 'Project', 'Rate', 'Stage',
'Task', 'Title', 'Todoist', 'User', 'Wordpress', 'logger'
]
Loading