get_value('similar_albums_'.$GroupID); if ($Top10 === false || isset($Top10[$GroupID])) { $VotePairs = $Cache->get_value('vote_pairs_'.$GroupID, true); if ($VotePairs === false || isset($VotePairs[$GroupID])) { $DB->query(" SELECT v.GroupID, SUM(IF(v.Type='Up',1,0)) AS Ups, COUNT(1) AS Total FROM ( SELECT UserID FROM users_votes WHERE GroupID = $GroupID AND Type='Up' ) AS a JOIN users_votes AS v USING (UserID) WHERE v.GroupID != $GroupID GROUP BY v.GroupID HAVING Ups > 0"); $VotePairs = $DB->to_array('GroupID', MYSQL_ASSOC, false); $Cache->cache_value('vote_pairs_'.$GroupID, $VotePairs, 21600); } $GroupScores = array(); foreach ($VotePairs as $RatingGroup) { // Cutting out the junk should speed the sort significantly $Score = binomial_score($RatingGroup['Ups'], $RatingGroup['Total']); if ($Score > 0.3) { $GroupScores[$RatingGroup['GroupID']] = $Score; } } arsort($GroupScores); $Top10 = array_slice($GroupScores, 0, 10, true); $Cache->cache_value('similar_albums_'.$GroupID, $Top10, 0.5 * 3600); } if (count($Top10) > 0) { ?> $MatchGroup) { $i++; $Str = Artists::display_artists($MatchGroup['ExtendedArtists']).''.$MatchGroup['Name'].''; ?>
 People who like this album also liked... (Show)