public function ajaxTableLastAcquisition($username, $page)
 {
     $arrayRawGamesOwned = BGGData::getGamesOwned();
     $arrayGamesDetails = BGGData::getDetailOwned($arrayRawGamesOwned);
     $arrayRawGamesAndExpansionsOwned = BGGData::getGamesAndExpansionsOwned();
     Stats::getCollectionArrays($arrayRawGamesOwned);
     Stats::getOwnedRelatedArrays($arrayGamesDetails);
     Stats::getAcquisitionRelatedArrays($arrayRawGamesAndExpansionsOwned);
     $params['lastAcquisition'] = $this->getLastAcquisition($page);
     $params['userinfo'] = UserInfos::getUserInformations(BGGData::getUserInfos());
     return \View::make('partials.lines-table-last-games-acquisition', $params);
 }
 public function vendre()
 {
     $arrayRawUserInfos = BGGData::getUserInfos();
     $arrayRawGamesAndExpansionsOwned = BGGData::getGamesAndExpansionsOwned();
     $arrayRawGamesOwned = BGGData::getGamesOwned();
     $arrayUserInfos = UserInfos::getUserInformations($arrayRawUserInfos);
     $arrayRawGamesPlays = BGGData::getPlays();
     $arrayRawGamesRated = BGGData::getGamesRated();
     Stats::getPlaysRelatedArrays($arrayRawGamesPlays);
     Stats::getAcquisitionRelatedArrays($arrayRawGamesAndExpansionsOwned);
     Stats::getRatedRelatedArrays($arrayRawGamesRated);
     Stats::getCollectionArrays($arrayRawGamesOwned);
     $params['userinfo'] = $arrayUserInfos;
     $gamesToSell = [];
     $nbToGetInEachCategory = floor(count($GLOBALS['data']['gamesCollection']) / 5);
     // Less rentable
     if (SessionManager::ifLoginAsSelf()) {
         $arrayRentable = Stats::getRentabiliteCollection();
         $lessRentable = array_reverse(array_slice($arrayRentable, count($arrayRentable) - $nbToGetInEachCategory));
         foreach ($lessRentable as &$game) {
             $game['rentabilite'] = round($game['rentabilite'], 2) . ' $ par partie';
         }
         $this->compileGameArray($gamesToSell, $lessRentable, 'Moins rentable', 1, 'rentabilite');
     }
     // Played since
     $gameLessTimePlayed = Stats::getCollectionTimePlayed();
     $mostTimeSincePlayed = array_slice($gameLessTimePlayed, 0, $nbToGetInEachCategory);
     foreach ($mostTimeSincePlayed as &$game) {
         if (!$game['since']) {
             $game['since'] = 'jamais';
         }
     }
     $this->compileGameArray($gamesToSell, $mostTimeSincePlayed, 'Joué depuis longtemps', 1, 'since');
     // Less played
     $lessPlayed = $GLOBALS['data']['gamesCollection'];
     usort($lessPlayed, 'App\\Lib\\Utility::compareNumPlays');
     $lessPlayed = array_slice($lessPlayed, 0, $nbToGetInEachCategory);
     foreach ($lessPlayed as &$game) {
         if ($game['numplays'] == 0) {
             $game['numplays'] = 'jamais';
         } else {
             $game['numplays'] . ' parties';
         }
     }
     $this->compileGameArray($gamesToSell, $lessPlayed, 'Moins joués', 1, 'numplays');
     // Less rated
     $arrayRated = Stats::getRatedCollection();
     $lessRated = array_reverse(array_slice($arrayRated, count($arrayRated) - $nbToGetInEachCategory));
     foreach ($lessRated as &$game) {
         $game['rating'] .= ' / 10';
     }
     $this->compileGameArray($gamesToSell, $lessRated, 'Moins bien classé', 1, 'rating');
     usort($gamesToSell, 'App\\Lib\\Utility::compareOrderWeight');
     $params['games'] = $gamesToSell;
     return \View::make('rapports_vendre', $params);
 }
示例#3
0
 /**
  * @param $page
  * @return array
  */
 private function getAcquisitionByMonthArray($page)
 {
     $arrayRawGamesAndExpansionsOwned = BGGData::getGamesAndExpansionsOwned();
     Stats::getAcquisitionRelatedArrays($arrayRawGamesAndExpansionsOwned);
     $acquisitionArray = Graphs::getAcquisitionByMonth($page);
     return $acquisitionArray;
 }