From 1db198c6058a355098ec8bcc4d675f5e1239bd6d Mon Sep 17 00:00:00 2001 From: Justintime50 <39606064+Justintime50@users.noreply.github.com> Date: Tue, 5 Sep 2023 19:51:23 -0600 Subject: [PATCH] fix: page_size param for projects endpoint --- CHANGELOG.md | 4 ++++ harvey/_version.py | 2 +- harvey/repos/projects.py | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b42da4c..1e8dd4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## v1.0.1 (2023-09-05) + +- Fixes a bug where `page_size` for the `/projects` endpoint wasn't respected + ## v1.0.0 (2023-09-01) - Drops support for Python 3.7 diff --git a/harvey/_version.py b/harvey/_version.py index 1f356cc..cd7ca49 100644 --- a/harvey/_version.py +++ b/harvey/_version.py @@ -1 +1 @@ -__version__ = '1.0.0' +__version__ = '1.0.1' diff --git a/harvey/repos/projects.py b/harvey/repos/projects.py index 04c2bb7..6a7d5df 100644 --- a/harvey/repos/projects.py +++ b/harvey/repos/projects.py @@ -14,6 +14,7 @@ def retrieve_projects(request: flask.Request) -> Dict[str, List[Any]]: """Retrieve a list of projects stored in Harvey by scanning the `projects` directory.""" projects: Dict[str, Any] = {'projects': []} + total_projects = 0 project_owners = os.listdir(Config.projects_path) page_size = get_page_size(request) @@ -25,11 +26,11 @@ def retrieve_projects(request: flask.Request) -> Dict[str, List[Any]]: project_names.remove('.DS_Store') for project_name in project_names: final_project_name = f'{project_owner}-{project_name}' - projects['projects'].append(final_project_name) + total_projects += 1 - if len(projects['projects']) > page_size: - break + if len(projects['projects']) < page_size: + projects['projects'].append(final_project_name) - projects['total_count'] = len(projects['projects']) + projects['total_count'] = total_projects return projects