Skip to content

Commit 449623f

Browse files
committed
refactor: 👌 add docs to utils.extend_model.py
1 parent e794d3b commit 449623f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

utils/extend_model.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
1-
# TODO : check if we can improve this by using the overwritten __add__ method
21
def add_customer_name_to_projects(projects, customers):
2+
"""
3+
Add attribute customer_name in project model, based on customer_id of the
4+
project
5+
:param (list) projects: projects retrieved from project repository
6+
:param (list) customers: customers retrieved from customer repository
7+
8+
TODO : check if we can improve this by using the overwritten __add__ method
9+
"""
310
for project in projects:
411
for customer in customers:
512
if project.customer_id == customer.id:
613
setattr(project, 'customer_name', customer.name)
714

815

916
def add_project_name_to_time_entries(time_entries, projects):
17+
"""
18+
Add attribute project_name in time-entry model, based on project_id of the
19+
time_entry
20+
:param (list) time_entries: time_entries retrieved from time-entry repository
21+
:param (list) projects: projects retrieved from project repository
22+
23+
TODO : check if we can improve this by using the overwritten __add__ method
24+
"""
1025
for time_entry in time_entries:
1126
for project in projects:
1227
if time_entry.project_id == project.id:

0 commit comments

Comments
 (0)