Compare commits
4 Commits
fix/write-
...
d5043100a7
| Author | SHA1 | Date | |
|---|---|---|---|
| d5043100a7 | |||
| 932cc7191c | |||
| d983cfdd3b | |||
| 50649baeed |
@@ -123,7 +123,7 @@ SUMMARY_STRATEGIES = {
|
|||||||
|
|
||||||
DISCUSSION_RULES: dict[str, list[str]] = {
|
DISCUSSION_RULES: dict[str, list[str]] = {
|
||||||
"universal": [
|
"universal": [
|
||||||
"פרק הדיון = אסה רציפה. אין כותרות משנה (H2/H3). מעברים רק עם ביטויי מעבר טקסטואליים.",
|
"פרק הדיון = מאסה רציפה. אין כותרות משנה (H2/H3). מעברים רק עם ביטויי מעבר טקסטואליים.",
|
||||||
"חריג יחיד לכותרות משנה: נושאים נפרדים לחלוטין (למשל: הקלה בגובה + התייחסות לטענות נוספות).",
|
"חריג יחיד לכותרות משנה: נושאים נפרדים לחלוטין (למשל: הקלה בגובה + התייחסות לטענות נוספות).",
|
||||||
"טווח אורך סעיפים: 20 עד 600+ מילים. סעיף עם ציטוט מקיף = בלוק אחד שלם, לא שבירה לסעיפים קצרים.",
|
"טווח אורך סעיפים: 20 עד 600+ מילים. סעיף עם ציטוט מקיף = בלוק אחד שלם, לא שבירה לסעיפים קצרים.",
|
||||||
],
|
],
|
||||||
|
|||||||
18
web/app.py
18
web/app.py
@@ -3057,8 +3057,16 @@ async def api_get_methodology(category: str):
|
|||||||
items = {}
|
items = {}
|
||||||
for key, default_val in defaults.items():
|
for key, default_val in defaults.items():
|
||||||
if key in overrides:
|
if key in overrides:
|
||||||
|
raw = overrides[key]["rule_value"]
|
||||||
|
# asyncpg returns JSONB as a raw JSON string when no codec is registered.
|
||||||
|
# Parse it back to a Python object so the frontend receives the correct type.
|
||||||
|
if isinstance(raw, str):
|
||||||
|
try:
|
||||||
|
raw = json.loads(raw)
|
||||||
|
except (json.JSONDecodeError, TypeError):
|
||||||
|
pass
|
||||||
items[key] = {
|
items[key] = {
|
||||||
"value": overrides[key]["rule_value"],
|
"value": raw,
|
||||||
"is_override": True,
|
"is_override": True,
|
||||||
"updated_at": overrides[key]["created_at"].isoformat() if overrides[key]["created_at"] else None,
|
"updated_at": overrides[key]["created_at"].isoformat() if overrides[key]["created_at"] else None,
|
||||||
}
|
}
|
||||||
@@ -3095,10 +3103,14 @@ async def api_update_methodology(category: str, key: str, req: MethodologyUpdate
|
|||||||
raise HTTPException(422, "content_checklists value must be a non-empty string")
|
raise HTTPException(422, "content_checklists value must be a non-empty string")
|
||||||
|
|
||||||
pool = await db.get_pool()
|
pool = await db.get_pool()
|
||||||
|
# json.dumps → text, then PostgreSQL casts text→jsonb.
|
||||||
|
# Passing a Python list directly causes "expected str, got list" in asyncpg;
|
||||||
|
# passing a str with ::jsonb causes double-encoding (stored as JSONB string).
|
||||||
|
# ::text::jsonb bypasses asyncpg's codec and lets PostgreSQL parse the JSON.
|
||||||
await pool.execute(
|
await pool.execute(
|
||||||
"INSERT INTO appeal_type_rules (id, appeal_type, rule_category, rule_key, rule_value) "
|
"INSERT INTO appeal_type_rules (id, appeal_type, rule_category, rule_key, rule_value) "
|
||||||
"VALUES (gen_random_uuid(), '_global', $1, $2, $3::jsonb) "
|
"VALUES (gen_random_uuid(), '_global', $1, $2, $3::text::jsonb) "
|
||||||
"ON CONFLICT (appeal_type, rule_category, rule_key) DO UPDATE SET rule_value = $3::jsonb",
|
"ON CONFLICT (appeal_type, rule_category, rule_key) DO UPDATE SET rule_value = $3::text::jsonb",
|
||||||
category, key, json.dumps(req.value, ensure_ascii=False),
|
category, key, json.dumps(req.value, ensure_ascii=False),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user