Get recently pushed papers for a user Args: user_id: User ID limit: Maximum number of papers to return Returns: List of papers with push information
(user_id: str, limit: int = 50)
| 1264 | # ============== Recent Push Operations ============== |
| 1265 | |
| 1266 | def get_recent_pushes(user_id: str, limit: int = 50) -> List[Dict]: |
| 1267 | """ |
| 1268 | Get recently pushed papers for a user |
| 1269 | |
| 1270 | Args: |
| 1271 | user_id: User ID |
| 1272 | limit: Maximum number of papers to return |
| 1273 | |
| 1274 | Returns: |
| 1275 | List of papers with push information |
| 1276 | """ |
| 1277 | conn = get_connection() |
| 1278 | cursor = conn.cursor() |
| 1279 | |
| 1280 | # Get papers pushed in the last 7 days |
| 1281 | since_date = (datetime.now() - timedelta(days=7)).date().isoformat() |
| 1282 | |
| 1283 | cursor.execute(""" |
| 1284 | SELECT p.*, bl.push_id, bl.timestamp as pushed_at, bl.metadata |
| 1285 | FROM papers p |
| 1286 | JOIN behavior_logs bl ON p.id = bl.paper_id |
| 1287 | WHERE bl.user_id = ? |
| 1288 | AND bl.action = 'pushed' |
| 1289 | AND date(bl.timestamp) >= ? |
| 1290 | ORDER BY bl.timestamp DESC |
| 1291 | LIMIT ? |
| 1292 | """, (user_id, since_date, limit)) |
| 1293 | |
| 1294 | rows = cursor.fetchall() |
| 1295 | conn.close() |
| 1296 | |
| 1297 | return [_build_paper_dict(row) for row in rows] |
| 1298 | |
| 1299 | |
| 1300 | def get_latest_push(user_id: str) -> Optional[Dict]: |
no test coverage detected