Skip to content
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
Next Next commit
fix: TT-238 adds condition to control when there are no time entries …
…records in get method
  • Loading branch information
Pablo authored and Pablo committed May 10, 2021
commit 744278829a9651ba9e76165a9cc91eb59d825844
11 changes: 8 additions & 3 deletions time_tracker_api/time_entries/time_entries_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ def count(

return result.next()

def add_complementary_info(self, time_entries=None, max_count=None):
def add_complementary_info(
self, time_entries=None, max_count=None, existConditions=False
):
if time_entries:
custom_conditions = create_in_condition(time_entries, "project_id")
custom_conditions_activity = create_in_condition(
Expand All @@ -168,7 +170,7 @@ def add_complementary_info(self, time_entries=None, max_count=None):

users = AzureConnection().users()
add_user_email_to_time_entries(time_entries, users)
elif not time_entries and len(conditions) > 1:
elif not time_entries and existConditions:
abort(HTTPStatus.NOT_FOUND, "Time entry not found")
return time_entries

Expand Down Expand Up @@ -230,8 +232,11 @@ def find_all(

function_mapper = self.get_mapper_or_dict(mapper)
time_entries = list(map(function_mapper, result))
existConditions = len(conditions) > 1

return self.add_complementary_info(time_entries, max_count)
return self.add_complementary_info(
time_entries, max_count, existConditions
)

def create_sql_test_users_exclusion_condition(self, test_user_ids):
if test_user_ids != None:
Expand Down