From 8811a65163b6b83c1d252a17a3fb1887b16d76c1 Mon Sep 17 00:00:00 2001 From: Khoroshevskyi Date: Mon, 16 Sep 2024 10:30:39 -0400 Subject: [PATCH] added order by stars --- docs/changelog.md | 3 ++- pepdbagent/modules/annotation.py | 8 +++++--- requirements/requirements-all.txt | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 207ff2a..76ac388 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -3,7 +3,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format. ## [0.11.1] -- 2024-09-04 -- Added metadata table for namespace tar files +- Added archive table of namespaces +- Added sort by stars ## [0.11.0] -- 2024-07-24 - Added validation schemas diff --git a/pepdbagent/modules/annotation.py b/pepdbagent/modules/annotation.py index c9c7612..8f755b0 100644 --- a/pepdbagent/modules/annotation.py +++ b/pepdbagent/modules/annotation.py @@ -300,7 +300,7 @@ def _get_projects( :param limit: limit of return results :param offset: number of results off set (that were already showed) :param order_by: sort the result-set by the information - Options: ["name", "update_date", "submission_date"] + Options: ["update_date", "name", "submission_date", "stars"] [Default: "update_date"] :param order_desc: Sort the records in descending order. [Default: False] :param filter_by: data to use filter on. @@ -371,7 +371,7 @@ def _add_order_by_keyword( :param statement: sqlalchemy representation of a SELECT statement. :param by: sort the result-set by the information - Options: ["name", "update_date", "submission_date"] + Options: ["name", "update_date", "submission_date", "stars"] [Default: "update_date"] :param desc: Sort the records in descending order. [Default: False] :return: sqlalchemy representation of a SELECT statement with order by keyword @@ -382,6 +382,8 @@ def _add_order_by_keyword( order_by_obj = Projects.name elif by == SUBMISSION_DATE_KEY: order_by_obj = Projects.submission_date + elif by == "stars": + order_by_obj = Projects.number_of_stars else: _LOGGER.warning( f"order by: '{by}' statement is unavailable. Projects are sorted by 'update_date'" @@ -614,7 +616,7 @@ def get_projects_list( :param limit: limit of return results :param offset: number of results off set (that were already showed) :param order_by: sort the result-set by the information - Options: ["name", "update_date", "submission_date"] + Options: ["name", "update_date", "submission_date", "stars"] [Default: "update_date"] :param order_desc: Sort the records in descending order. [Default: False] :param filter_by: data to use filter on. diff --git a/requirements/requirements-all.txt b/requirements/requirements-all.txt index cba088f..82073a6 100644 --- a/requirements/requirements-all.txt +++ b/requirements/requirements-all.txt @@ -1,6 +1,6 @@ sqlalchemy>=2.0.0 logmuse>=0.2.7 -peppy>=0.40.4 +peppy>=0.40.6 ubiquerg>=0.6.2 coloredlogs>=15.0.1 pytest-mock