/** * @param null $year * * @return array */ public function getPoolReport($year = null) { $season = new Season($year); $report = ['pools' => $this->poolReportQuery->countPools($season), 'entries' => $this->entryReportQuery->countEntries($season), 'confirmed_entries' => $this->entryReportQuery->countConfirmedEntries($season), 'distinct_entries' => $this->entryReportQuery->countDistinctEntries($season), 'entry_average' => $this->entryReportQuery->calculateAverageEntriesPerPool($season), 'wishlist_average' => $this->wishlistReportQuery->calculateCompletedWishlists($season), 'ip_usage' => $this->ipReportQuery->calculateIpUsage($season), 'pool_chart_data' => $this->poolReportQuery->queryDataForMonthlyPoolChart($season), 'entry_chart_data' => $this->entryReportQuery->queryDataForMonthlyEntryChart($season), 'yearly_pool_chart_data' => $this->poolReportQuery->queryDataForYearlyPoolChart(), 'yearly_entry_chart_data' => $this->entryReportQuery->queryDataForYearlyEntryChart()]; if ($year) { $report['total_pools'] = $this->poolReportQuery->countAllPoolsUntilDate($season->getEnd()); $report['total_entries'] = $this->entryReportQuery->countAllEntriesUntilDate($season->getEnd()); $report['total_confirmed_entries'] = $this->entryReportQuery->countConfirmedEntriesUntilDate($season->getEnd()); $report['total_entry_average'] = $this->entryReportQuery->calculateAverageEntriesPerPoolUntilDate($season->getEnd()); $report['total_wishlist_average'] = $this->wishlistReportQuery->calculateCompletedWishlistsUntilDate($season->getEnd()); $report['total_distinct_entries'] = $this->entryReportQuery->countDistinctEntriesUntilDate($season->getEnd()); $report['total_pool_chart_data'] = $this->poolReportQuery->queryDataForPoolChartUntilDate($season->getEnd()); $report['total_entry_chart_data'] = $this->entryReportQuery->queryDataForEntryChartUntilDate($season->getEnd()); } return $report; }
/** * @param $year * * @return array */ public function getComparison($year) { $season1 = new Season($year); $season2 = new Season($year - 1); return ['pool_count_difference' => $this->poolReportQuery->calculatePoolCountDifferenceBetweenSeasons($season1, $season2), 'entry_count_difference' => $this->entryReportQuery->calculateEntryCountDifferenceBetweenSeasons($season1, $season2), 'confirmed_entry_count_difference' => $this->entryReportQuery->calculateConfirmedEntryCountDifferenceBetweenSeasons($season1, $season2), 'distinct_entry_count_difference' => $this->entryReportQuery->calculateDistinctEntryCountDifferenceBetweenSeasons($season1, $season2), 'average_entries_difference' => $this->entryReportQuery->calculateAverageEntriesPerPoolBetweenSeasons($season1, $season2), 'average_wishlist_difference' => $this->wishlistReportQuery->calculateCompletedWishlistDifferenceBetweenSeasons($season1, $season2)]; }