Skip to content

Commit c95fc27

Browse files
PabloPablo
authored andcommitted
fix: TT-220 apply refactoring on some code
1 parent 9e9fd0c commit c95fc27

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

time_tracker_api/projects/projects_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def get_all(
125125
customers_ids_conditions = (
126126
customers_ids_conditions + customers_id
127127
if customers_id
128-
else customers_id
128+
else customers_ids_conditions
129129
)
130130

131131
projects = self.repository.find_all(

time_tracker_api/time_entries/time_entries_dao.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ def get_all(self, conditions: dict = None, **kwargs) -> list:
9898
conditions=conditions,
9999
)
100100
date_range = self.handle_date_filter_args(args=conditions)
101-
limit = conditions.get("limit", None)
102-
conditions.pop("limit", None)
101+
limit = conditions.pop("limit", None)
103102
azure_connection = AzureConnection()
104103
current_user_is_tester = azure_connection.is_test_user(
105104
event_ctx.user_id
@@ -143,12 +142,11 @@ def get_lastest_entries_by_project(
143142
for id_project in projects_ids:
144143
conditions.update({"project_id": id_project})
145144

146-
limit = 1
147145
latest = self.repository.find_all_entries(
148146
event_ctx,
149147
conditions=conditions,
150148
date_range=date_range,
151-
max_count=limit,
149+
max_count=1,
152150
)
153151

154152
if len(latest) > 0:

time_tracker_api/time_entries/time_entries_repository.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,6 @@ def find_all(
196196
time_entries, max_count, exist_conditions
197197
)
198198

199-
def create_sql_test_users_exclusion_condition(self, test_user_ids):
200-
if test_user_ids != None:
201-
tuple_string = convert_list_to_tuple_string(test_user_ids)
202-
return "AND c.owner_id NOT IN {list}".format(list=tuple_string)
203-
204-
return ""
205-
206199
def get_last_entry(
207200
self,
208201
owner_id: str,

0 commit comments

Comments
 (0)