fix(halachot): ספירת-תור אמיתית + עדכון-חי בתגי-הכרעה (#6/#7/#8)
המספרים בתגי תור-ההלכות היו תקרות-שאילתה ולא ספירה אמיתית: - "ממתינות 500" = pendingData.items.length עם limit=500 - "נדחו 1000 / אושרו 1000" = useHalachotByStatus(...,1000) — תקרה 1000 ובלי refetchInterval התגים התעדכנו רק בכניסה לדף. המקור האמיתי כבר קיים: /api/precedent-library/stats מריץ COUNT(*) אמיתי (pending=1373, approved=2100). מוסיף לו halachot_rejected + halachot_deferred, מחבר את תגי-ה-HalachaReviewPanel למקור הזה, ומוסיף polling (30s) כדי שהם יתעדכנו חי. מסיר את useHalachaCount המיותר. תור-העבודה עצמו עדיין נטען עד 500 פריטים (cap-עבודה לגיטימי); רק תצוגת הספירות תוקנה להציג את הסך-האמיתי. Invariants: מקיים G1 (נרמול-במקור — ספירה אמיתית מ-COUNT(*) במקום len(rows) מתוקרת בקריאה) ו-G2 (מאחד על מקור-הספירה הקיים, ללא endpoint-ספירה מקביל). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6719,6 +6719,12 @@ async def precedent_library_stats() -> dict:
|
||||
halachot_approved = await conn.fetchval(
|
||||
"SELECT COUNT(*) FROM halachot WHERE review_status IN ('approved', 'published')"
|
||||
)
|
||||
halachot_rejected = await conn.fetchval(
|
||||
"SELECT COUNT(*) FROM halachot WHERE review_status = 'rejected'"
|
||||
)
|
||||
halachot_deferred = await conn.fetchval(
|
||||
"SELECT COUNT(*) FROM halachot WHERE review_status = 'deferred'"
|
||||
)
|
||||
return {
|
||||
"precedents_total": int(total or 0),
|
||||
"by_practice_area": [
|
||||
@@ -6732,6 +6738,8 @@ async def precedent_library_stats() -> dict:
|
||||
"halachot_total": int(halachot_total or 0),
|
||||
"halachot_pending": int(halachot_pending or 0),
|
||||
"halachot_approved": int(halachot_approved or 0),
|
||||
"halachot_rejected": int(halachot_rejected or 0),
|
||||
"halachot_deferred": int(halachot_deferred or 0),
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user