Skip to content

Commit

Permalink
Iniitial work on moving to bootstrap for stats
Browse files Browse the repository at this point in the history
  • Loading branch information
mantis committed Mar 2, 2014
1 parent c546a05 commit 0424ddc
Show file tree
Hide file tree
Showing 28 changed files with 506 additions and 979 deletions.
43 changes: 0 additions & 43 deletions daily_totals_raw.php

This file was deleted.

8 changes: 0 additions & 8 deletions etc/config.inc.default
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ $fo_h1 = "<font face=\"verdana,arial,helvetica\" size=\"+2\">";
$fo_h2 = "<font face=\"verdana,arial,helvetica\" size=\"+1\">";
$foff = "</font>";

$co_bgcolor = "#dddddd";
$co_text = "#000000";
$co_link = "#222255";
$co_heada = "#ffffff";
$co_lista = "#9999cc";
$co_listb = "#9999bb";
$co_listc = "#cccccc";

// Use this project if no project_id specified
$default_project = 28;

Expand Down
9 changes: 0 additions & 9 deletions etc/global.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@
include "error.php";
require "config.inc";

global $random_stats, $random_function;
$random_function = "*(random()*1000)";
$random_stats = 0;
/*
if ( rand(1,100) <= 20 ) {
$random_stats = 1;
}
*/

if ( isset($log_timing) ) {
if ( $log_timing == 1 ) {
include_once "timing.inc";
Expand Down
22 changes: 3 additions & 19 deletions etc/participantstats.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,15 @@ function ParticipantStats(&$dbPtr, &$project, $id = -1, $date = -1)
*/
function load($id, &$project, $date)
{
global $random_stats, $random_function;

$qs = "SELECT last_date + 1 - first_date as Days_Working,";
if ( $random_stats == 1 ) {
$qs .= " day_rank$random_function::int AS day_rank, overall_rank$random_function::int AS overall_rank,";
$qs .= " work_today$random_function AS work_today, work_total$random_function AS work_total,";
} else {
$qs .= " day_rank, overall_rank,";
$qs .= " work_today, work_total,";
}
$qs .= " day_rank, overall_rank,";
$qs .= " work_today, work_total,";
$qs .= " overall_rank_previous-overall_rank as overall_change,";
$qs .= " day_rank_previous-day_rank as day_change, ";
$qs .= " first_date, last_date ";
$qs .= " FROM email_rank ";
$qs .= " WHERE id = " . $this->_db->prepare_int($id);
$qs .= " AND project_id = " . $this->_db->prepare_int($project->get_id());
if ($date != -1) {
// do..
}

$this -> _state = $this -> _db -> query_first ($qs);
return $this -> are_stats_loaded();
Expand All @@ -111,14 +101,8 @@ function loadHistorical($id, $project, $start, $days_back)

function get_stats_history($lastdays = -1)
{
global $random_stats, $random_function;

$qs = "SELECT to_char(date, 'dd-Mon-yyyy') as stats_date,";
if ( $random_stats == 1 ) {
$qs .= " SUM(work_units)$random_function as work_units";
} else {
$qs .= " SUM(work_units) as work_units";
}
$qs .= " SUM(work_units) as work_units";
$qs .= " FROM email_contrib ec, stats_participant sp";
$qs .= " WHERE ec.project_id=" . $this->_db->prepare_int($this->_project->get_id());
$qs .= " AND (sp.id=".$this->_id." or sp.retire_to=" . $this->_db->prepare_int($this->_id).")";
Expand Down
3 changes: 2 additions & 1 deletion etc/project.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (isset($_REQUEST['project_id'])) {
if (isset($default_project)) {
$project_id = $default_project;
} else {
$project_id = 27;
$project_id = 28;
}
}

Expand Down Expand Up @@ -70,6 +70,7 @@ if (isset($_REQUEST['team'])) {
$gdb = new DB($conn_string);
$gproj = new Project($gdb, $project_id);


function last_update($type)
{
global $lastupdate, $project_id, $gdb;
Expand Down
4 changes: 4 additions & 0 deletions etc/project.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ function get_type()
return $this -> _type;
}

function is_project_loaded() {
return !($this -> _state === null);
}

/**
* Instantiates a new project object, and loads it with the specified project's information.
*
Expand Down
8 changes: 0 additions & 8 deletions etc/psecure.inc
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ function authfail($why,$tfrom,$tid,$tpass,$desc = "") {
exit;
}

if(isset($id) && isset($pass) && $pass != "") {
if($debug > 0) trigger_error("Authenticating through URL.",E_USER_NOTICE);
# ID and PASS provided in url, use these over all other options
$test_id = $id;
$test_pass = $pass;
$test_from = "url";
} else {
if(isset($_COOKIE['sbid'])) {
if($debug > 0) trigger_error("Authenticating through Cookie.",E_USER_NOTICE);
# We have a cookie set, use this
Expand All @@ -62,7 +55,6 @@ if(isset($id) && isset($pass) && $pass != "") {
}
}
}
if($debug > 0) print "<!-- Username: $test_id, Password: $test_pass -->\n";

// @TODO - pass null or gproj here?
$gpart = new Participant($gdb, $gproj, $test_id);
Expand Down
18 changes: 4 additions & 14 deletions etc/teamstats.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,11 @@ function TeamStats(&$dbPtr, &$prjPtr, $team_id = -1, $stats_date = -1)
***/
function load($id, $date)
{
global $random_stats, $random_function;

$qs = 'SELECT first_date, last_date';
if ( $random_stats == 1 ) {
$qs .= " , day_rank$random_function::int AS day_rank, day_rank_previous$random_function::int AS day_rank_previous";
$qs .= " , overall_rank$random_function::int AS overall_rank, overall_rank_previous$random_function::int AS overall_rank_previous";
$qs .= " , members_today$random_function AS members_today, members_overall$random_function AS members_overall";
$qs .= " , members_current$random_function AS members_current";
$qs .= " , work_today$random_function AS work_today, work_total$random_function AS work_total";
} else {
$qs .= " , day_rank, day_rank_previous";
$qs .= " , overall_rank, overall_rank_previous";
$qs .= " , members_today, members_overall, members_current";
$qs .= " , work_today, work_total";
}
$qs .= " , day_rank, day_rank_previous";
$qs .= " , overall_rank, overall_rank_previous";
$qs .= " , members_today, members_overall, members_current";
$qs .= " , work_today, work_total";
$qs .= ' , last_date::DATE - first_date::DATE + 1 AS days_working ';
$qs .= ' FROM team_rank ';
$qs .= ' WHERE team_id = ' . $this->_db->prepare_int($id);
Expand Down
Loading

0 comments on commit 0424ddc

Please sign in to comment.