feat: complete heaven readings and screener publication
This commit is contained in:
@@ -131,6 +131,25 @@ class HeavenRepositoryMixin:
|
||||
items = self.list_heaven_readings(user_id, mode, context_date, 1)
|
||||
return items[0] if items else None
|
||||
|
||||
def heaven_reading_interpretation_version(
|
||||
self, user_id: int, reading_id: int
|
||||
) -> str:
|
||||
with self.connect() as connection:
|
||||
row = connection.execute(
|
||||
"""
|
||||
SELECT context_snapshot FROM heaven_readings
|
||||
WHERE id = ? AND user_id = ?
|
||||
""",
|
||||
(int(reading_id), int(user_id)),
|
||||
).fetchone()
|
||||
if not row:
|
||||
return ""
|
||||
try:
|
||||
snapshot = json.loads(str(row["context_snapshot"] or "{}"))
|
||||
except (TypeError, json.JSONDecodeError):
|
||||
return ""
|
||||
return str(snapshot.get("interpretation_version") or "")
|
||||
|
||||
def delete_heaven_reading(self, user_id: int, reading_id: int) -> bool:
|
||||
with self.connect() as connection:
|
||||
cursor = connection.execute(
|
||||
|
||||
Reference in New Issue
Block a user