Mazenbs commited on
Commit
6b84275
·
verified ·
1 Parent(s): befcce0

Update supabase_utils.py

Browse files
Files changed (1) hide show
  1. supabase_utils.py +17 -17
supabase_utils.py CHANGED
@@ -104,22 +104,22 @@ def save_law_to_supabase(law_json: dict):
104
 
105
  # ----------------------- إضافة المواد -----------------------
106
  for art in sec.get("articles", []):
107
- article_number = int(art["number"]) if art.get("number") else None
108
- article_content = (art.get("text") or "").strip()
109
- article_tag = (art.get("tag") or "").strip()
110
- article_tables = art.get("tables", [])
111
-
112
- # ❌ تجاهل المادة إذا كانت فارغة تمامًا
113
- if not article_content and not article_tag:
114
- continue
115
-
116
- supabase.table("articles").insert({
117
- "chapter_id": section_id,
118
- "article_number": article_number,
119
- "content": article_content,
120
- "tag": article_tag,
121
- "lowid": law_id,
122
- "tables": article_tables or [],
123
- }).execute()
124
 
125
  print(f"✔ تم حفظ جميع الأقسام والمواد للقانون: {title}")
 
104
 
105
  # ----------------------- إضافة المواد -----------------------
106
  for art in sec.get("articles", []):
107
+ article_number = int(art["number"]) if art.get("number") else None
108
+ article_content = (art.get("text") or "").strip()
109
+ article_tag = (art.get("tag") or "").strip()
110
+ article_tables = art.get("tables", [])
111
+
112
+ # ❌ تجاهل المادة إذا كانت فارغة تمامًا
113
+ if not article_content and not article_tag:
114
+ continue
115
+
116
+ supabase.table("articles").insert({
117
+ "chapter_id": section_id,
118
+ "article_number": article_number,
119
+ "content": article_content,
120
+ "tag": article_tag,
121
+ "lowid": law_id,
122
+ "tables": article_tables or [],
123
+ }).execute()
124
 
125
  print(f"✔ تم حفظ جميع الأقسام والمواد للقانون: {title}")