Limit raw rewrite selection to AI rejected posts

This commit is contained in:
Your Name
2026-08-05 16:14:42 +05:00
parent 34f339d434
commit c6f434df08
2 changed files with 5 additions and 10 deletions
+3 -2
View File
@@ -100,8 +100,9 @@ canonical git repository as FN-8. Code work for both projects must happen in
- The editor textarea must show only clean editable text. - The editor textarea must show only clean editable text.
- The list preview in `/editor` should show the publication preview, including composed hashtags. - The list preview in `/editor` should show the publication preview, including composed hashtags.
- `build_publication_text()` in `src/vk_parser_app/text_utils.py` is display/composition helper only. Do not use it before writing `final_text` to DB. - `build_publication_text()` in `src/vk_parser_app/text_utils.py` is display/composition helper only. Do not use it before writing `final_text` to DB.
- `/raw` has a manual checkbox action to send rejected posts back to rewrite. - `/raw` has a manual checkbox action to send AI-rejected posts back to
It resets stale rewrite/final fields and sets `rewrite_status='pending'`. rewrite. It is intentionally limited to `qualification_status='rejected'`;
editor-rejected posts that were AI-accepted are not selectable there.
- VK/MAX successful publications also sync `raw_posts.publication_status` and - VK/MAX successful publications also sync `raw_posts.publication_status` and
`editorial_status` to `published`; this keeps VK-only projects from leaving `editorial_status` to `published`; this keeps VK-only projects from leaving
posts forever in the editor's accepted tab. posts forever in the editor's accepted tab.
+2 -8
View File
@@ -1125,10 +1125,7 @@ def prepare_raw_post(row: Any) -> dict[str, Any]:
post["ai_badge"] = ai_badge(post) post["ai_badge"] = ai_badge(post)
post["can_send_to_rewrite"] = ( post["can_send_to_rewrite"] = (
post.get("status") == "storage_ready" post.get("status") == "storage_ready"
and ( and (post.get("qualification_status") or "pending") == "rejected"
(post.get("qualification_status") or "pending") == "rejected"
or (post.get("editorial_status") or "review") == "rejected"
)
) )
return post return post
@@ -2733,10 +2730,7 @@ async def raw_send_to_rewrite(
FROM raw_posts FROM raw_posts
WHERE id=ANY($1::bigint[]) WHERE id=ANY($1::bigint[])
AND status='storage_ready' AND status='storage_ready'
AND ( AND COALESCE(qualification_status, 'pending')='rejected'
COALESCE(qualification_status, 'pending')='rejected'
OR COALESCE(editorial_status, 'review')='rejected'
)
FOR UPDATE FOR UPDATE
) )
UPDATE raw_posts rp UPDATE raw_posts rp