[Fusionforge-commits] r15026 - in branches/Branch_5_1: . src/common/reporting

Roland Mas lolando at fusionforge.org
Wed Jan 4 18:44:44 CET 2012


Author: lolando
Date: 2012-01-04 18:44:43 +0100 (Wed, 04 Jan 2012)
New Revision: 15026

Modified:
   branches/Branch_5_1/
   branches/Branch_5_1/src/common/reporting/ReportSetup.class.php
Log:
Fixed generation of statistics: the 'BETWEEN foo AND bar' SQL construct needs foo < bar

Modified: branches/Branch_5_1/src/common/reporting/ReportSetup.class.php
===================================================================
--- branches/Branch_5_1/src/common/reporting/ReportSetup.class.php	2011-12-21 11:28:32 UTC (rev 15025)
+++ branches/Branch_5_1/src/common/reporting/ReportSetup.class.php	2012-01-04 17:44:43 UTC (rev 15026)
@@ -534,16 +534,14 @@
  */
 function backfill_users_added_weekly($count=10000) {
 
-	$arr =& $this->getWeekStartArr();
+	$arr = array_slice ($this->getMonthStartArr(), -$count-1);
+	rsort($arr);
 
 	for ($i=0; $i<count($arr); $i++) {
 		if (!$this->users_added_weekly($arr[$i])) {
 			$this->setError('backfill_users_added_weekly:: Error adding weekly row: '.db_error());
 			return false;
 		}
-		if ($i >= $count) {
-			break;
-		}
 	}
 	return true;
 }
@@ -575,16 +573,14 @@
  */
 function backfill_groups_added_weekly($count=10000) {
 
-	$arr =& $this->getWeekStartArr();
+	$arr = array_slice ($this->getMonthStartArr(), -$count-1);
+	rsort($arr);
 
 	for ($i=0; $i<count($arr); $i++) {
 		if (!$this->groups_added_weekly($arr[$i])) {
 			$this->setError('backfill_groups_added_weekly:: Error adding weekly row: '.db_error());
 			return false;
 		}
-		if ($i >= $count) {
-			break;
-		}
 	}
 	return true;
 }
@@ -617,7 +613,8 @@
  */
 function backfill_users_added_monthly($count=10000) {
 
-	$arr =& $this->getMonthStartArr();
+	$arr = array_slice ($this->getMonthStartArr(), -$count-1);
+	rsort($arr);
 
 //skipping first one
 	for ($i=1; $i<count($arr); $i++) {
@@ -625,9 +622,6 @@
 			$this->setError('backfill_users_added_monthly:: Error adding monthly row: '.db_error());
 			return false;
 		}
-		if ($i >= $count) {
-			break;
-		}
 	}
 	return true;
 }
@@ -660,7 +654,8 @@
  */
 function backfill_groups_added_monthly($count=10000) {
 
-	$arr =& $this->getMonthStartArr();
+	$arr = array_slice ($this->getMonthStartArr(), -$count-1);
+	rsort($arr);
 
 //skipping first one
 	for ($i=1; $i<count($arr); $i++) {
@@ -668,9 +663,6 @@
 			$this->setError('backfill_groups_added_monthly:: Error adding monthly row: '.db_error());
 			return false;
 		}
-		if ($i >= $count) {
-			break;
-		}
 	}
 	return true;
 }
@@ -802,16 +794,14 @@
  */
 function backfill_users_cum_weekly($count=10000) {
 
-	$arr =& $this->getWeekStartArr();
+	$arr = array_slice ($this->getMonthStartArr(), -$count-1);
+	rsort($arr);
 
 	for ($i=0; $i<count($arr); $i++) {
 		if (!$this->groups_cum_weekly($arr[$i])) {
 			$this->setError('backfill_users_cum_weekly:: Error adding weekly row: '.db_error());
 			return false;
 		}
-		if ($i >= $count) {
-			break;
-		}
 	}
 	return true;
 }
@@ -843,16 +833,14 @@
  */
 function backfill_groups_cum_weekly($count=10000) {
 
-	$arr =& $this->getWeekStartArr();
+	$arr = array_slice ($this->getMonthStartArr(), -$count-1);
+	rsort($arr);
 
 	for ($i=0; $i<count($arr); $i++) {
 		if (!$this->users_cum_weekly($arr[$i])) {
 			$this->setError('backfill_groups_cum_weekly:: Error adding weekly row: '.db_error());
 			return false;
 		}
-		if ($i >= $count) {
-			break;
-		}
 	}
 	return true;
 }
@@ -884,7 +872,8 @@
  */
 function backfill_users_cum_monthly($count=10000) {
 
-	$arr =& $this->getMonthStartArr();
+	$arr = array_slice ($this->getMonthStartArr(), -$count-1);
+	rsort($arr);
 
 //skip first one
 	for ($i=1; $i<count($arr); $i++) {
@@ -892,9 +881,6 @@
 			$this->setError('backfill_users_cum_monthly:: Error adding monthly row: '.db_error());
 			return false;
 		}
-		if ($i >= $count) {
-			break;
-		}
 	}
 	return true;
 }
@@ -926,7 +912,8 @@
  */
 function backfill_groups_cum_monthly($count=10000) {
 
-	$arr =& $this->getMonthStartArr();
+	$arr = array_slice ($this->getMonthStartArr(), -$count-1);
+	rsort($arr);
 
 //skip first one
 	for ($i=1; $i<count($arr); $i++) {
@@ -934,9 +921,6 @@
 			$this->setError('backfill_groups_cum_monthly:: Error adding monthly row: '.db_error());
 			return false;
 		}
-		if ($i >= $count) {
-			break;
-		}
 	}
 	return true;
 }
@@ -1080,16 +1064,14 @@
  */
 function backfill_user_act_weekly($count=10000) {
 
-	$arr =& $this->getWeekStartArr();
+	$arr = array_slice ($this->getMonthStartArr(), -$count-1);
+	rsort($arr);
 
 	for ($i=0; $i<count($arr); $i++) {
 		if (!$this->user_act_weekly($arr[$i])) {
 			$this->setError('backfill_user_act_weekly:: Error adding weekly row: '.db_error());
 			return false;
 		}
-		if ($i >= $count) {
-			break;
-		}
 	}
 	return true;
 }
@@ -1125,16 +1107,14 @@
  */
 function backfill_user_act_monthly($count=10000) {
 
-	$arr =& $this->getMonthStartArr();
+	$arr = array_slice ($this->getMonthStartArr(), -$count-1);
+	rsort($arr);
 
 	for ($i=1; $i<count($arr); $i++) {
 		if (!$this->user_act_monthly($arr[$i],($arr[$i-1]-1))) {
 			$this->setError('backfill_user_act_monthly:: Error adding monthly row: '.db_error());
 			return false;
 		}
-		if ($i >= $count) {
-			break;
-		}
 	}
 	return true;
 }
@@ -1300,16 +1280,14 @@
  */
 function backfill_group_act_weekly($count=10000) {
 
-	$arr =& $this->getWeekStartArr();
+	$arr = array_slice ($this->getMonthStartArr(), -$count-1);
+	rsort($arr);
 
 	for ($i=0; $i<count($arr); $i++) {
 		if (!$this->group_act_weekly($arr[$i])) {
 			$this->setError('backfill_user_act_weekly:: Error adding weekly row: '.db_error());
 			return false;
 		}
-		if ($i >= $count) {
-			break;
-		}
 	}
 	return true;
 }
@@ -1348,16 +1326,14 @@
  */
 function backfill_group_act_monthly($count=10000) {
 
-	$arr =& $this->getMonthStartArr();
+	$arr = array_slice ($this->getMonthStartArr(), -$count-1);
+	rsort($arr);
 
 	for ($i=1; $i<count($arr); $i++) {
 		if (!$this->group_act_monthly($arr[$i],($arr[$i-1]-1))) {
 			$this->setError('backfill_group_act_monthly:: Error adding monthly row: '.db_error());
 			return false;
 		}
-		if ($i >= $count) {
-			break;
-		}
 	}
 	return true;
 }




More information about the Fusionforge-commits mailing list