Created
December 2, 2017 11:18
-
-
Save laruence/fe11e3743ececb7adb4791ab030acc58 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
class ReactionRatingService | |
{ | |
public function calculateBoostPoints() | |
{ | |
while ($reaction = $reactions) { | |
$reactionRatings = $this->validFunction(); | |
$totalWeight = 0; | |
$runningScore = 0; | |
$queue = []; | |
foreach ($reactionRatings as $ratingData) { | |
if ($runningScore != $reaction['Score']) { | |
if ( ! $ratingData['BoostEarned']) { | |
$queue[] = $ratingData['UserID']; | |
} | |
} else { | |
foreach ($queue as $userId) { | |
$userBoostPointsRecalculate[$userId][] = $reaction['ID']; | |
} | |
} | |
$totalWeight += $ratingData['Weight']; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment