Evaluator::should_use_aggregate_calculations( awsmug\Torro_Forms\DB_Objects\Forms\Form $form )

Checks whether aggregate calculations should be used for evaluating all submissions of a specific form.


See also



(awsmug\Torro_Forms\DB_Objects\Forms\Form) (Required) Form for which to check this.


(bool) True if aggregate calculations should be used, false otherwise.


File: src/modules/evaluators/evaluator.php

	protected function should_use_aggregate_calculations( $form ) {
		$submission_count = $this->module->manager()->forms()->get_child_manager( 'submissions' )->count( 0, $form->id );

		 * Filters the breakpoint for when to use aggregate results for evaluating submissions.
		 * If the number of available completed submissions for a form is higher than the breakpoint, aggregate results will
		 * be used. Otherwise the calculations will be performed live.
		 * Powerful setups may increase the breakpoint as needed to get more accurate results for higher submission counts,
		 * as aggregate results may possibly be less precise than live calculations.
		 * @since 1.0.0
		 * @param int    $breakpoint Breakpoint count to use. Default is 100 submissions.
		 * @param string $slug       Slug of the evaluator for which the breakpoint is checked.
		 * @param Form   $form       Form for which the breakpoint is checked.
		$breakpoint = apply_filters( "{$this->module->manager()->get_prefix()}use_aggregate_calculations_breakpoint", 100, $this->slug, $form );

		return $submission_count['completed'] > $breakpoint;


Version Description
1.0.0 Introduced.