com_courses: draw every page of a form whose PDF was re-uploaded - #1926
Merged
nkissebe merged 1 commit intoSep 16, 2026
Merged
Conversation
A re-uploaded PDF renders its page images into forms/<id>/<max version + 1>/, but saving the layout bumps the question version every time. Once the layout is saved twice after an upload, the latest version no longer has a matching directory and PdfForm::eachPage() falls back to the newest older one. That fallback set $version_dir, so the image URLs pointed at the new PDF, but left $base at the form root. The page count therefore came from the original upload's PNGs. When the new PDF has more pages, the extra pages are never rendered, yet getQuestionAnswerMap() still requires their questions -- so students get "Please ensure you have selected an answer for each question" with no incomplete marker on screen, and a timed form only accepts the submit once the limit expires, scoring the hidden questions as unanswered. The layout editor and results view share eachPage() and lose the same pages. $base is now taken from whichever version dir was chosen, so the page count and the image URLs always read the same directory. The fallback also read the natsorted list by position, but natsort() keeps the scandir keys, so it could pick the wrong older directory. The list is now reindexed and walked in order. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
nkissebe
pushed a commit
that referenced
this pull request
Sep 16, 2026
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
nkissebe
pushed a commit
that referenced
this pull request
Sep 16, 2026
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A re-uploaded PDF renders its page images into forms//<max version + 1>/, but saving the layout bumps the question version every time. Once the layout is saved twice after an upload, the latest version no longer has a matching directory and PdfForm::eachPage() falls back to the newest older one.
That fallback set $version_dir, so the image URLs pointed at the new PDF, but left $base at the form root. The page count therefore came from the original upload's PNGs. When the new PDF has more pages, the extra pages are never rendered, yet getQuestionAnswerMap() still requires their questions -- so students get "Please ensure you have selected an answer for each question" with no incomplete marker on screen, and a timed form only accepts the submit once the limit expires, scoring the hidden questions as unanswered. The layout editor and results view share eachPage() and lose the same pages.
$base is now taken from whichever version dir was chosen, so the page count and the image URLs always read the same directory.
The fallback also read the natsorted list by position, but natsort() keeps the scandir keys, so it could pick the wrong older directory. The list is now reindexed and walked in order.
https://nanohub.org/support/ticket/514078