DVPP: fix for incomplete page range designations
Posted by mholmes on 17 Sep 2018 in Activity log
AC wants all page-ranges to be shown in their entirety, so I ran some XQuery to generate fixes for the abbreviated ones:
let $commands := for $p in //table_data[@name='poems']/row return let $pages := $p/field[@name='po_pages']/text(), $id := $p/field[@name='po_id']/text() return if (matches($pages, '^\d\d\d-\d\d$')) then concat('UPDATE `poems` set `po_pages` = "', substring($pages, 1, 4), substring($pages, 1, 1), substring($pages, 5), '" WHERE `po_id` = "', $id, '";') else if (matches($pages, '^\d\d-\d$')) then concat('UPDATE `poems` set `po_pages` = "', substring($pages, 1, 3), substring($pages, 1, 1), substring($pages, 4), '" WHERE `po_id` = "', $id, '";') else () return string-join($commands, ' ')
then ran the commands (after testing in dev) to fix the existing problems. Added a new test to the diagnostics for this.