*
* Copyright 2003-2004, Tim Perdue/GForge, LLC
*
- * This file is part of FusionForge.
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
*
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * FusionForge is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with FusionForge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require_once $gfcommon.'reporting/Report.class.php';
time_code int not null CONSTRAINT reptimetrk_timecode REFERENCES rep_time_category(time_code),
hours float not null);";
$sql[]=$sql1;
-// $sql[]="CREATE UNIQUE INDEX reptimetrk_weekusrtskcde ON
+// $sql[]="CREATE UNIQUE INDEX reptimetrk_weekusrtskcde ON
// rep_time_tracking (week,user_id,project_task_id,time_code);";
- $sql[]="CREATE INDEX reptimetracking_userdate ON
+ $sql[]="CREATE INDEX reptimetracking_userdate ON
rep_time_tracking (user_id,week);";
$sql[]="INSERT INTO rep_time_category VALUES ('1','Coding');";
SELECT user_id,
sum(tracker_opened) AS tracker_opened,
sum(tracker_closed) AS tracker_closed,
- sum(forum) AS forum,
- sum(docs) AS docs,
+ sum(forum) AS forum,
+ sum(docs) AS docs,
sum(cvs_commits) AS cvs_commits,
sum(tasks_opened) AS tasks_opened,
- sum(tasks_closed) AS tasks_closed
+ sum(tasks_closed) AS tasks_closed
FROM rep_user_act_monthly
GROUP BY user_id;";
//overall activity
$sql[]="DROP VIEW rep_site_act_daily_vw";
- $sql[]="CREATE VIEW rep_site_act_daily_vw AS
+ $sql[]="CREATE VIEW rep_site_act_daily_vw AS
SELECT day,
sum(tracker_opened) AS tracker_opened,
sum(tracker_closed) AS tracker_closed,
GROUP BY day;";
$sql[]="DROP VIEW rep_site_act_weekly_vw";
- $sql[]="CREATE VIEW rep_site_act_weekly_vw AS
+ $sql[]="CREATE VIEW rep_site_act_weekly_vw AS
SELECT week,
sum(tracker_opened) AS tracker_opened,
sum(tracker_closed) AS tracker_closed,
$sql[]="DROP VIEW rep_site_act_oa_vw";
$sql[]="CREATE VIEW rep_site_act_oa_vw AS
+ SELECT
sum(tracker_opened) AS tracker_opened,
sum(tracker_closed) AS tracker_closed,
sum(forum) AS forum,
array($day)) ;
- return db_query_params ('INSERT INTO rep_users_added_daily (day,added)
- VALUES ($1,(SELECT count(*) FROM users WHERE status=$2 AND add_date
+ return db_query_params ('INSERT INTO rep_users_added_daily (day,added)
+ VALUES ($1,(SELECT count(*) FROM users WHERE status=$2 AND add_date
BETWEEN $3 AND $4 ))',
array($day,
'A',
array($day)) ;
- return db_query_params ('INSERT INTO rep_groups_added_daily (day,added)
- VALUES ($1,(SELECT count(*) FROM groups WHERE status=$2 AND register_time
+ return db_query_params ('INSERT INTO rep_groups_added_daily (day,added)
+ VALUES ($1,(SELECT count(*) FROM groups WHERE status=$2 AND register_time
BETWEEN $3 AND $4 ))',
array($day,
'A',
*/
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;
}
*/
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;
}
*/
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++) {
$this->setError('backfill_users_added_monthly:: Error adding monthly row: '.db_error());
return false;
}
- if ($i >= $count) {
- break;
- }
}
return true;
}
*/
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++) {
$this->setError('backfill_groups_added_monthly:: Error adding monthly row: '.db_error());
return false;
}
- if ($i >= $count) {
- break;
- }
}
return true;
}
array($day)) ;
- return db_query_params ('INSERT INTO rep_users_cum_daily (day,total)
- VALUES ($1,(SELECT count(*) FROM users WHERE status=$2 AND add_date
+ return db_query_params ('INSERT INTO rep_users_cum_daily (day,total)
+ VALUES ($1,(SELECT count(*) FROM users WHERE status=$2 AND add_date
BETWEEN 0 AND $3))',
array($day,
'A',
array($day)) ;
- return db_query_params ('INSERT INTO rep_groups_cum_daily (day,total)
- VALUES ($1,(SELECT count(*) FROM groups WHERE status=$2 AND register_time
+ return db_query_params ('INSERT INTO rep_groups_cum_daily (day,total)
+ VALUES ($1,(SELECT count(*) FROM groups WHERE status=$2 AND register_time
BETWEEN 0 AND $3))',
array($day,
'A',
*/
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;
}
*/
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;
}
*/
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++) {
$this->setError('backfill_users_cum_monthly:: Error adding monthly row: '.db_error());
return false;
}
- if ($i >= $count) {
- break;
- }
}
return true;
}
*/
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++) {
$this->setError('backfill_groups_cum_monthly:: Error adding monthly row: '.db_error());
return false;
}
- if ($i >= $count) {
- break;
- }
}
return true;
}
*/
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;
}
*/
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;
}
*/
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;
}
*/
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;
}