Skip to content

Commit

Permalink
ensure links are build correctly for multiple versions fixes bug 789416
Browse files Browse the repository at this point in the history
  • Loading branch information
ossreleasefeed committed Oct 3, 2012
1 parent f03ef77 commit bb0a1a9
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions webapp-php/application/controllers/products.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private function _determineTopchangersProductVersion($product, $version, $top_cr
* @param int The total number of topchangers to include
* @return array An array of top changers
*/
private function _determineTopchangersProduct($product, $top_crashers, $versions_count, $trend_down=true, $topchangers_count) {
private function _determineTopchangersProduct($product, $top_crashers, $versions_count, $trend_down=true, $topchangers_count, $versions) {
$crashes = array();
$changers = array();

Expand All @@ -265,7 +265,7 @@ private function _determineTopchangersProduct($product, $top_crashers, $versions
'changeInRank' => $top_crasher->changeInRank,
'signature' => $top_crasher->signature,
'trendClass' => $top_crasher->trendClass,
'url' => $this->_formatTopchangerURL($product, null, $top_crasher)
'url' => $this->_formatTopchangerURL($product, $versions, $top_crasher)
);
} else {
$top_changers['currentRank'] += $top_crasher->currentRank;
Expand Down Expand Up @@ -321,6 +321,7 @@ private function _formatTopchangerURL($product, $version=null, $top_crasher)
{
$range_value = $this->duration;
$range_unit = 'days';
$current_versions = array();

$sigParams = array(
'range_value' => $range_value,
Expand All @@ -330,7 +331,14 @@ private function _formatTopchangerURL($product, $version=null, $top_crasher)
);

if (!empty($version)) {
$sigParams['version'] .= ":" . $version;
if(count($version) > 1) {
foreach ($version as $current_version) {
array_push($current_versions, $product . ":" . $current_version);
}
$sigParams['version'] = $current_versions;
} else {
$sigParams['version'] .= ":" . $version;
}
}

return url::base() . 'report/list?' . html::query_string($sigParams);
Expand Down Expand Up @@ -617,7 +625,7 @@ public function product($product)
$throttle[] = $featured_version->throttle;
$i++;
}
$top_changers = $this->_determineTopchangersProduct($product, $top_crashers, count($this->featured_versions), true, $this->_determineTopchangersCountDashboard());
$top_changers = $this->_determineTopchangersProduct($product, $top_crashers, count($this->featured_versions), true, $this->_determineTopchangersCountDashboard(), null);

$results = $this->daily_model->get($product, $daily_versions, $operating_systems, $date_start, $date_end, 'any');
$statistics = $this->daily_model->prepareStatistics($results, 'by_version', $product, $daily_versions, $operating_systems, $date_start, $date_end, $throttle);
Expand Down Expand Up @@ -702,19 +710,19 @@ public function productBuilds($product, $rss=false)
*/
public function productTopchangers($product, $extension=false)
{
$versions = array();
foreach ($this->featured_versions as $featured_version) {
$versions[] = $featured_version->version;
}

$top_crashers = $this->_determineTopcrashersProduct($product);
$top_changers = $this->_determineTopchangersProduct($product, $top_crashers, count($this->featured_versions), false, $this->_determineTopchangersCountPage());
$top_changers = $this->_determineTopchangersProduct($product, $top_crashers, count($versions), false, $this->_determineTopchangersCountPage(), $versions);

if ($extension == 'rss') {
$this->_topchangersRSS($product, null, $top_changers);
} elseif ($extension == 'csv') {
$this->_topchangersCSV($product, null, $top_changers);
} else {
$versions = array();
foreach ($this->featured_versions as $featured_version) {
$versions[] = $featured_version->version;
}

$this->setView('products/product_topchangers');
$this->setViewData(
array(
Expand Down

0 comments on commit bb0a1a9

Please sign in to comment.