Browse: Home / Classes / WpProQuiz_Helper_QuestionOrder /

WpProQuiz_Helper_QuestionOrder::backfill_to_count

WpProQuiz_Helper_QuestionOrder::backfill_to_count( WpProQuiz_Model_Question[] $ordered,  WpProQuiz_Model_Question[] $pool,  int $target )

Tops up an ordered question set to a target count by appending unused questions from the pool, preserving the existing order.


Description #

Used when resuming a quiz whose saved subset lost questions (deleted/updated, or never fully persisted): the missing slots are replaced with other valid questions so the resumed quiz keeps its configured number of questions instead of shrinking.


Parameters #

$ordered

(WpProQuiz_Model_Question[]) (Required) Questions already selected, as a sequential list.

$pool

(WpProQuiz_Model_Question[]) (Required) All available questions to draw replacements from.

$target

(int) (Required) Desired number of questions.


Return #

(WpProQuiz_Model_Question[]) The ordered set, topped up towards $target where the pool allows, as a sequential list.


Source #

File: includes/lib/wp-pro-quiz/lib/helper/WpProQuiz_Helper_QuestionOrder.php


Changelog #

Changelog
Version Description
5.1.6 Introduced.