B 三件:周报打印入口+手机端三屏+知识点自动归类(235 测试)

This commit is contained in:
2026-11-22 15:15:54 +08:00
parent 924b4bee43
commit 11a7f18b31
12 changed files with 412 additions and 4 deletions
+11 -2
View File
@@ -19,7 +19,7 @@ from contextlib import contextmanager
from datetime import date, datetime, timedelta
from pathlib import Path
from . import content, cut, judging, kp_graph, ocr, practice, scheduler, tencent_ocr, wechat
from . import content, cut, judging, kp_graph, kp_match, ocr, practice, scheduler, tencent_ocr, wechat
from .db import TZ, add_days, connect, log_event, new_id, now, row_to_dict, rows_to_list, today
CONSENT_VERSION = "v1"
@@ -867,6 +867,8 @@ def add_manual_mistake(conn, gid: str, cid: str, subject: str, stem: str,
pid = new_id("p")
qid = new_id("q")
if not kp:
kp = kp_match.classify(subject, stem) # 手输也顺手归一下,归不上留空
with tx(conn):
conn.execute("INSERT INTO papers (id, child_id, subject, image_count, source, created_at)"
" VALUES (?,?,?,0,?,?)", (pid, cid, subject, source, now()))
@@ -1125,7 +1127,9 @@ def weekly_sheet_html(conn, gid: str, cid: str, week_of: str | None = None) -> s
<title>本周错题 · {_esc(child["nickname"])}</title>
<style>
@page {{ size: A5; margin: 12mm; }}
body {{ font-family: "Microsoft YaHei", "PingFang SC", sans-serif; color:#24211f; font-size:12pt; }}
body {{ font-family: "Microsoft YaHei", "PingFang SC", sans-serif; color:#24211f; font-size:12pt;
max-width: 148mm; margin: 6mm auto; padding: 0 4mm; }}
@media print {{ body {{ max-width: none; margin: 0; padding: 0; }} }}
h1 {{ font-size:15pt; margin:0 0 2mm; }}
.meta {{ color:#6b6560; font-size:9pt; margin-bottom:4mm; }}
.q {{ margin: 0 0 5mm; page-break-inside: avoid; }}
@@ -1754,6 +1758,11 @@ def import_scan_picks(conn, gid: str, cid: str, subject: str, draft_id: str,
else:
questions.append(r)
# 切题不给知识点;这里按题干补一次,补不上就留空(学情分析宁可少,不可错)
for q in questions:
if not q.get("kp"):
q["kp"] = kp_match.classify(q.get("subject") or subject, q.get("stem"))
pid = new_id("p")
folder = UPLOAD_DIR / cid
folder.mkdir(parents=True, exist_ok=True)