补全9月11日至13日课评:为13名学生创建请假文档,为5个班级创建总结文档

This commit is contained in:
chengzi
2026-09-13 19:34:34 +08:00
parent 167d832353
commit 21001eccf5
1322 changed files with 37510 additions and 4136 deletions

View File

@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
import io, re, sys
def find_oj_section(html, start):
n = len(html)
depth = 1
i = start + len('<div class="oj-section"')
while depth > 0 and i < n:
o = html.find('<div', i)
c = html.find('</div>', i)
if c == -1:
return -1
if o != -1 and o < c:
depth += 1
i = o + 4
else:
depth -= 1
i = c + 6
return i
for f in sys.argv[1:]:
c = io.open(f, encoding='utf-8').read()
pat = re.compile(r'<div class="oj-section" data-oj-section="([^"]+)">')
print('===', f.replace('\\', '/').split('/')[-1])
total_panels = 0
bad = []
for m in pat.finditer(c):
name = m.group(1)
end = find_oj_section(c, m.start())
blk = c[m.start():end]
expl = blk.count('class="oj-explains"')
panels = blk.count('class="prob-detail"')
total_panels += panels
if expl != 1 or panels != 5:
bad.append('%s: expl=%d panels=%d' % (name, expl, panels))
print(' oj-sections:', c.count('data-oj-section='), '| total prob-detail:', total_panels)
if bad:
print(' MISMATCH blocks:', bad)
else:
print(' OK: every student has exactly 1 题目讲解 block with 5 panels')
print(' div balance:', c.count('<div'), '/', c.count('</div>'))