Improve stream sorting with direction toggle feature

Enhanced the stream sorting functionality to support sorting direction (ascending or descending) based on user preferences in both the backend and UI. Introduced 'SortingOption' in the schema to capture sorting criteria with direction, and updated the sorting logic to accommodate these changes. Additionally, modified the user interface to include buttons for toggling sort directions, providing a more intuitive sorting experience for users.
This commit is contained in:
mhdzumair
2024-11-29 23:08:15 +05:30
parent 7619c12d14
commit 29f4bd11aa
6 changed files with 201 additions and 38 deletions
+3 -2
View File
@@ -25,6 +25,7 @@ from api import middleware
from api.scheduler import setup_scheduler
from db import crud, database, schemas
from db.config import settings
from db.schemas import SortingOption
from kodi.routes import kodi_router
from metrics.routes import metrics_router
from scrapers.routes import router as scrapers_router
@@ -183,9 +184,9 @@ async def configure(
)
sorted_sorting_options = user_data.torrent_sorting_priority + [
option
SortingOption(key=option)
for option in const.TORRENT_SORTING_PRIORITY_OPTIONS
if option not in user_data.torrent_sorting_priority
if not user_data.is_sorting_option_present(option)
]
# Sort languages based on user preference