diff --git a/time_tracker_api/time_entries/time_entries_model.py b/time_tracker_api/time_entries/time_entries_model.py index 02f18828..aa66ff60 100644 --- a/time_tracker_api/time_entries/time_entries_model.py +++ b/time_tracker_api/time_entries/time_entries_model.py @@ -17,14 +17,13 @@ from commons.data_access_layer.database import EventContext from time_tracker_api.activities import activities_model -from time_tracker_api.customers import customers_model from utils.extend_model import ( - add_project_name_to_time_entries, + add_project_info_to_time_entries, add_activity_name_to_time_entries, create_in_condition, create_custom_query_from_str, - add_user_email_to_time_entries, add_customer_name_to_projects, + add_user_email_to_time_entries, ) from utils.time import ( datetime_str, @@ -220,17 +219,12 @@ def find_all( time_entries, "activity_id" ) - customer_dao = customers_model.create_dao() - customers = customer_dao.get_all(visible_only=False) - project_dao = projects_model.create_dao() projects = project_dao.get_all( custom_sql_conditions=[custom_conditions], visible_only=False ) - add_customer_name_to_projects(projects, customers) - - add_project_name_to_time_entries(time_entries, projects) + add_project_info_to_time_entries(time_entries, projects) activity_dao = activities_model.create_dao() activities = activity_dao.get_all( diff --git a/time_tracker_api/time_entries/time_entries_namespace.py b/time_tracker_api/time_entries/time_entries_namespace.py index 0eade8bb..84c48e6a 100644 --- a/time_tracker_api/time_entries/time_entries_namespace.py +++ b/time_tracker_api/time_entries/time_entries_namespace.py @@ -150,7 +150,7 @@ title='Customer Name', max_length=50, description='Name of the customer the entry belongs to', - example=faker.word(['development', 'QA']), + example=faker.company(), ), } time_entry_response_fields.update(common_fields) diff --git a/utils/extend_model.py b/utils/extend_model.py index e7065a24..6eecedcf 100644 --- a/utils/extend_model.py +++ b/utils/extend_model.py @@ -16,9 +16,9 @@ def add_customer_name_to_projects(projects, customers): setattr(project, 'customer_name', customer.name) -def add_project_name_to_time_entries(time_entries, projects): +def add_project_info_to_time_entries(time_entries, projects): """ - Add attribute project_name in time-entry model, based on project_id of the + Add project info in time-entry model, based on project_id of the time_entry :param (list) time_entries: time_entries retrieved from time-entry repository :param (list) projects: projects retrieved from project repository