{"publisher":"WESWOO","id":"barcode-zero-checkpoints","title":{"zh":"查看样例与复核查询","en":"View the records and verification query"},"setup_sql":"CREATE TABLE scan(label TEXT,raw_scan TEXT,pos_text TEXT);\nINSERT INTO scan VALUES ('012345678905','012345678905','12345678905');\nCREATE TABLE codes(variant TEXT,code TEXT,PRIMARY KEY(variant,code));\nINSERT INTO codes VALUES ('M','012345678905');","query_sql":"SELECT length(label),length(raw_scan),length(pos_text),\n (SELECT count(*) FROM codes WHERE code=s.label) AS catalog_matches,\n CASE WHEN raw_scan<>label THEN 'check scanner output'\n WHEN pos_text<>raw_scan THEN 'check POS input'\n WHEN (SELECT count(*) FROM codes WHERE code=s.label)<>1 THEN 'check catalog mapping'\n ELSE 'exact match' END AS first_check FROM scan s;","checks":[{"condition":"Only POS input lost the zero","change_sql":"","expected":[[12,12,11,1,"check POS input"]],"observed":[[12,12,11,1,"check POS input"]]},{"condition":"Both scan outputs lost the zero","change_sql":"UPDATE scan SET raw_scan=pos_text;","expected":[[12,11,11,1,"check scanner output"]],"observed":[[12,11,11,1,"check scanner output"]]},{"condition":"Two variants match the full string","change_sql":"UPDATE scan SET pos_text=label; INSERT INTO codes VALUES ('L','012345678905');","expected":[[12,12,12,2,"check catalog mapping"]],"observed":[[12,12,12,2,"check catalog mapping"]]},{"condition":"All three strings and mapping agree","change_sql":"UPDATE scan SET pos_text=label;","expected":[[12,12,12,1,"exact match"]],"observed":[[12,12,12,1,"exact match"]]}]}