plugin/drop-zone/Manager/DropzoneManager.php
public function updateScoreByScoreMax(Dropzone $dropzone, $oldScoreMax, $newScoreMax)
    {
        $ratio = !empty($oldScoreMax) && !empty($newScoreMax) ? $newScoreMax / $oldScoreMax : 0;

        if ($ratio) {
            $drops = $this->dropRepo->findBy(['dropzone' => $dropzone]);
            $corrections = $this->correctionRepo->findAllCorrectionsByDropzone($dropzone);
            $i = 0;

            $this->om->startFlushSuite();

            foreach ($drops as $drop) {
                $score = $drop->getScore();

                if ($score) {
                    $newScore = round($score * $ratio, 2);
                    $drop->setScore($newScore);
                    $this->om->persist($drop);
                }
                ++$i;

                if (0 === 200 % $i) {
                    $this->om->forceFlush();
                }
            }
            foreach ($corrections as $correction) {
                $score = $correction->getScore();

                if ($score) {
                    $newScore = round($score * $ratio, 2);
                    $correction->setScore($newScore);
                    $this->om->persist($correction);
                }
                ++$i;

                if (0 === 200 % $i) {
                    $this->om->forceFlush();
                }
            }
            $this->om->endFlushSuite();
        }
    }
public function updateScoreByScoreMax(Dropzone $dropzone, $oldScoreMax, $newScoreMax)
    {
        $ratio = !empty($oldScoreMax) && !empty($newScoreMax) ? $newScoreMax / $oldScoreMax : 0;

        if ($ratio) {
            $drops = $this->dropRepo->findBy(['dropzone' => $dropzone]);
            $corrections = $this->correctionRepo->findAllCorrectionsByDropzone($dropzone);
            $i = 0;

            $this->om->startFlushSuite();

            foreach ($drops as $drop) {
                $score = $drop->getScore();

                if ($score) {
                    $newScore = round($score * $ratio, 2);
                    $drop->setScore($newScore);
                    $this->om->persist($drop);
                }
                ++$i;

                if (0 === 200 % $i) {
                    $this->om->forceFlush();
                }
            }
            foreach ($corrections as $correction) {
                $score = $correction->getScore();

                if ($score) {
                    $newScore = round($score * $ratio, 2);
                    $correction->setScore($newScore);
                    $this->om->persist($correction);
                }
                ++$i;

                if (0 === 200 % $i) {
                    $this->om->forceFlush();
                }
            }
            $this->om->endFlushSuite();
        }
    }
public function updateScoreByScoreMax ( Dropzone $ dropzone , $ oldScoreMax , $ newScoreMax ) { $ ratio = ! empty ( $ oldScoreMax ) && ! empty ( $ newScoreMax ) ? $ newScoreMax / $ oldScoreMax : 0 ; if ( $ ratio ) { $ drops = $ this -> dropRepo -> findBy ( [ 'dropzone' => $ dropzone ] ) ; $ corrections = $ this -> correctionRepo -> findAllCorrectionsByDropzone ( $ dropzone ) ; $ i = 0 ; $ this -> om -> startFlushSuite ( ) ; foreach ( $ drops as $ drop ) { $ score = $ drop -> getScore ( ) ; if ( $ score ) { $ newScore = round ( $ score * $ ratio , 2 ) ; $ drop -> setScore ( $ newScore ) ; $ this -> om -> persist ( $ drop ) ; } ++ $ i ; if ( 0 === 200 % $ i ) { $ this -> om -> forceFlush ( ) ; } } foreach ( $ corrections as $ correction ) { $ score = $ correction -> getScore ( ) ; if ( $ score ) { $ newScore = round ( $ score * $ ratio , 2 ) ; $ correction -> setScore ( $ newScore ) ; $ this -> om -> persist ( $ correction ) ; } ++ $ i ; if ( 0 === 200 % $ i ) { $ this -> om -> forceFlush ( ) ; } } $ this -> om -> endFlushSuite ( ) ; } }
Fetches all drops and corrections and updates their score depending on new score max.

@param Dropzone $dropzone
@param float    $oldScoreMax
@param float    $newScoreMax
Fetches all drops and corrections and updates their score depending on new score max .