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
Prev Previous commit
Next Next commit
feat: Get data by a limit number
  • Loading branch information
fabidick22 committed Jun 23, 2020
commit 056d0c9867f80aa193ee1c927649c2fa31248f75
5 changes: 5 additions & 0 deletions time_tracker_api/time_entries/time_entries_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def find_all(
conditions: dict = {},
custom_sql_conditions: List[str] = [],
date_range: dict = {},
**kwargs,
):
custom_sql_conditions.append(
self.create_sql_date_range_filter(date_range)
Expand All @@ -175,6 +176,7 @@ def find_all(
conditions=conditions,
custom_sql_conditions=custom_sql_conditions,
custom_params=custom_params,
max_count=kwargs.get("max_count", None),
)

if time_entries:
Expand Down Expand Up @@ -381,11 +383,14 @@ def get_all(self, conditions: dict = None, **kwargs) -> list:
HTTPStatus.FORBIDDEN, "You don't have enough permissions."
)
date_range = self.handle_date_filter_args(args=conditions)
limit = conditions.get("limit", None)
conditions.pop("limit", None)
return self.repository.find_all(
event_ctx,
conditions=conditions,
custom_sql_conditions=custom_query,
date_range=date_range,
max_count=limit,
)

def get(self, id):
Expand Down