ItsMaxNorm commited on
Commit
a23c0ea
·
1 Parent(s): 7588d83

Update: accept all sort_by values

Browse files
Files changed (2) hide show
  1. .gitignore +2 -0
  2. app.py +4 -1
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ data/
2
+ __pycache__/
app.py CHANGED
@@ -147,7 +147,7 @@ async def get_community_papers(
147
  primary_area: Optional[str] = None,
148
  min_rating: Optional[float] = None,
149
  keywords: Optional[str] = None,
150
- sort_by: str = Query("year", regex="^(year|rating|combined_score|recency|title)$"),
151
  ):
152
  """Get paginated community papers with filters."""
153
  if not ready:
@@ -190,10 +190,13 @@ async def get_community_papers(
190
  # Sort mapping
191
  sort_map = {
192
  "year": "year DESC NULLS LAST",
 
193
  "rating": "rating_avg DESC NULLS LAST",
194
  "recency": "year DESC NULLS LAST",
195
  "title": "title ASC",
196
  "combined_score": "rating_avg DESC NULLS LAST",
 
 
197
  }
198
  order_sql = sort_map.get(sort_by, "year DESC NULLS LAST")
199
 
 
147
  primary_area: Optional[str] = None,
148
  min_rating: Optional[float] = None,
149
  keywords: Optional[str] = None,
150
+ sort_by: str = Query("year", regex="^(imported_at|year|rating|combined_score|recency|title|likes|views)$"),
151
  ):
152
  """Get paginated community papers with filters."""
153
  if not ready:
 
190
  # Sort mapping
191
  sort_map = {
192
  "year": "year DESC NULLS LAST",
193
+ "imported_at": "year DESC NULLS LAST",
194
  "rating": "rating_avg DESC NULLS LAST",
195
  "recency": "year DESC NULLS LAST",
196
  "title": "title ASC",
197
  "combined_score": "rating_avg DESC NULLS LAST",
198
+ "likes": "year DESC NULLS LAST",
199
+ "views": "year DESC NULLS LAST",
200
  }
201
  order_sql = sort_map.get(sort_by, "year DESC NULLS LAST")
202