Skip to content
Merged
Show file tree
Hide file tree
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
fix: TT-220 apply refactoring on some code
  • Loading branch information
Pablo authored and Pablo committed May 17, 2021
commit c95fc27cf7792c4e2e4a20dbbca6dbf68925edf4
2 changes: 1 addition & 1 deletion time_tracker_api/projects/projects_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def get_all(
customers_ids_conditions = (
customers_ids_conditions + customers_id
if customers_id
else customers_id
else customers_ids_conditions
)

projects = self.repository.find_all(
Expand Down
6 changes: 2 additions & 4 deletions time_tracker_api/time_entries/time_entries_dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ def get_all(self, conditions: dict = None, **kwargs) -> list:
conditions=conditions,
)
date_range = self.handle_date_filter_args(args=conditions)
limit = conditions.get("limit", None)
conditions.pop("limit", None)
limit = conditions.pop("limit", None)
azure_connection = AzureConnection()
current_user_is_tester = azure_connection.is_test_user(
event_ctx.user_id
Expand Down Expand Up @@ -143,12 +142,11 @@ def get_lastest_entries_by_project(
for id_project in projects_ids:
conditions.update({"project_id": id_project})

limit = 1
latest = self.repository.find_all_entries(
event_ctx,
conditions=conditions,
date_range=date_range,
max_count=limit,
max_count=1,
)

if len(latest) > 0:
Expand Down
7 changes: 0 additions & 7 deletions time_tracker_api/time_entries/time_entries_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,6 @@ def find_all(
time_entries, max_count, exist_conditions
)

def create_sql_test_users_exclusion_condition(self, test_user_ids):
if test_user_ids != None:
tuple_string = convert_list_to_tuple_string(test_user_ids)
return "AND c.owner_id NOT IN {list}".format(list=tuple_string)

return ""

def get_last_entry(
self,
owner_id: str,
Expand Down