possible fix for page miscounting bug
This commit is contained in:
parent
b3849f473f
commit
7c8ab8fe07
1 changed files with 9 additions and 7 deletions
|
|
@ -65,7 +65,7 @@ def verbose_get_qrs(x):
|
|||
try:
|
||||
magics, pages, qrnums, serials = [set(i) for i in zip(*infos)]
|
||||
except:
|
||||
print('wtf, skipping?')
|
||||
print("wtf, skipping?")
|
||||
return None
|
||||
print(
|
||||
"Found exam",
|
||||
|
|
@ -144,8 +144,10 @@ def main(input_file, verify, min_pages, append, output, force, num_workers):
|
|||
qrinfos = pool.map(
|
||||
verbose_get_qrs, [(fname, reader, i) for i in range(len(reader.pages))]
|
||||
)
|
||||
qrinfos = [i for i in qrinfos if i != None]
|
||||
for page_i, (qrinfo, rotated, scale) in enumerate(qrinfos):
|
||||
for page_i, qri in enumerate(qrinfos):
|
||||
if qri is None:
|
||||
continue
|
||||
qrinfo, rotated, scale = qri
|
||||
if len(qrinfo) == 0:
|
||||
continue # bad scan, skip it
|
||||
qrs = {}
|
||||
|
|
@ -207,24 +209,24 @@ def main(input_file, verify, min_pages, append, output, force, num_workers):
|
|||
print()
|
||||
if missing_pages:
|
||||
print(
|
||||
"\x1B[1;31mEXAMS MISSING PAGES (YOU MAY WANT TO ADD ADDITIONAL SCANS BEFORE MOVING ON):\x1B[0m"
|
||||
"\x1b[1;31mEXAMS MISSING PAGES (YOU MAY WANT TO ADD ADDITIONAL SCANS BEFORE MOVING ON):\x1b[0m"
|
||||
)
|
||||
for serial, missing in missing_pages.items():
|
||||
print(
|
||||
f' * {serial}: missing page(s) {",".join(map(str, sorted(missing)))}'
|
||||
)
|
||||
else:
|
||||
print("\x1B[1;32mAll exams have the required pages.\x1B[0m")
|
||||
print("\x1b[1;32mAll exams have the required pages.\x1b[0m")
|
||||
|
||||
if single_pages:
|
||||
print()
|
||||
print(
|
||||
"\x1B[1;31mSome pages only have one QR code (OK to proceed, but rectification may be worse):\x1B[0m"
|
||||
"\x1b[1;31mSome pages only have one QR code (OK to proceed, but rectification may be worse):\x1b[0m"
|
||||
)
|
||||
for serial, single in sorted(single_pages.items()):
|
||||
print(f' * exam {serial}: page(s) {",".join(map(str, sorted(single)))}')
|
||||
else:
|
||||
print("\x1B[1;32mAll pages have two QR codes.\x1B[0m")
|
||||
print("\x1b[1;32mAll pages have two QR codes.\x1b[0m")
|
||||
|
||||
with open(output, "w") as f:
|
||||
f.write(pprint.pformat((seen_files, pages_map)))
|
||||
|
|
|
|||
Loading…
Reference in a new issue