MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / get_recent_pushes

Function get_recent_pushes

skills/storage-helper/scripts/db_ops.py:1266–1297  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1264# ============== Recent Push Operations ==============
1265
1266def 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
1300def get_latest_push(user_id: str) -> Optional[Dict]:

Callers 1

generate_weekly_reportFunction · 0.85

Calls 7

_build_paper_dictFunction · 0.85
cursorMethod · 0.80
nowMethod · 0.80
get_connectionFunction · 0.70
executeMethod · 0.45
fetchallMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected