Skip to content

Commit

Permalink
FIX LoadPerUserIndicator if no active user in team
Browse files Browse the repository at this point in the history
  • Loading branch information
lbayle committed Mar 23, 2016
1 parent f510550 commit d9e6861
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions plugins/LoadPerUserIndicator/LoadPerUserIndicator.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,32 +193,36 @@ public function execute() {
$team = TeamCache::getInstance()->getTeam($this->teamid);

$members = $team->getActiveMembers($this->startTimestamp, $this->endTimestamp);
$formatedUseridString = implode( ', ', array_keys($members));

$extProjId = Config::getInstance()->getValue(Config::id_externalTasksProject);
$extTasksCatLeave = Config::getInstance()->getValue(Config::id_externalTasksCat_leave);

// get timetracks for each Issue,
$issueList = $this->inputIssueSel->getIssueList();
$bugidList = array_keys($issueList);

$query = "SELECT * FROM `codev_timetracking_table` ".
"WHERE userid IN (".$formatedUseridString.") ";

if (isset($this->startTimestamp)) { $query .= "AND date >= $this->startTimestamp "; }
if (isset($this->endTimestamp)) { $query .= "AND date <= $this->endTimestamp "; }
$query .= " ORDER BY bugid";

$result = SqlWrapper::getInstance()->sql_query($query);
if (!$result) {
echo "<span style='color:red'>ERROR: Query FAILED</span>";
exit;
}
$timeTracks = array();
while($row = SqlWrapper::getInstance()->sql_fetch_object($result)) {
$timeTracks[$row->id] = TimeTrackCache::getInstance()->getTimeTrack($row->id, $row);

if (count($members) > 0) {
$formatedUseridString = implode( ', ', array_keys($members));

$extProjId = Config::getInstance()->getValue(Config::id_externalTasksProject);
$extTasksCatLeave = Config::getInstance()->getValue(Config::id_externalTasksCat_leave);

// get timetracks for each Issue,
$issueList = $this->inputIssueSel->getIssueList();
$bugidList = array_keys($issueList);

$query = "SELECT * FROM `codev_timetracking_table` ".
"WHERE userid IN (".$formatedUseridString.") ";

if (isset($this->startTimestamp)) { $query .= "AND date >= $this->startTimestamp "; }
if (isset($this->endTimestamp)) { $query .= "AND date <= $this->endTimestamp "; }
$query .= " ORDER BY bugid";

$result = SqlWrapper::getInstance()->sql_query($query);
if (!$result) {
echo "<span style='color:red'>ERROR: Query FAILED</span>";
exit;
}
$timeTracks = array();
while($row = SqlWrapper::getInstance()->sql_fetch_object($result)) {
$timeTracks[$row->id] = TimeTrackCache::getInstance()->getTimeTrack($row->id, $row);
}
} else {
$timeTracks = array();
}

// ---
// un tablean de users avec repartition temps en categories: regular,external,sidetask
$teams = array($this->teamid);
Expand Down

0 comments on commit d9e6861

Please sign in to comment.