Skip to content

Commit

Permalink
added order by stars
Browse files Browse the repository at this point in the history
  • Loading branch information
khoroshevskyi committed Sep 16, 2024
1 parent b8d9ffb commit 8811a65
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions pepdbagent/modules/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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'"
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-all.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 8811a65

Please sign in to comment.