fix: admin贡献数不再包含所有公共配方
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 10s
Test / e2e-test (push) Successful in 49s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-12 10:14:06 +00:00
parent 4d855627e8
commit 6752b27f99

View File

@@ -1644,7 +1644,10 @@ def my_contribution(user=Depends(get_current_user)):
(f'%"from_user": "{display}"%',) (f'%"from_user": "{display}"%',)
).fetchall() ).fetchall()
adopted_names = list(set(r["target_name"] for r in adopted_rows if r["target_name"])) adopted_names = list(set(r["target_name"] for r in adopted_rows if r["target_name"]))
# pending: recipes still owned by user in public library # pending: recipes still owned by user in public library (skip admin — admin owns all public recipes)
if user.get("role") == "admin":
pending_names = []
else:
pending_rows = conn.execute( pending_rows = conn.execute(
"SELECT name FROM recipes WHERE owner_id = ?", (user["id"],) "SELECT name FROM recipes WHERE owner_id = ?", (user["id"],)
).fetchall() ).fetchall()