Current time: 05-25-2013, 02:37 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Results filtering after clicking on chart
10-20-2011, 06:49 PM
Post: #1
Results filtering after clicking on chart
Hi,

There is something wrong with filtering results after clicking on point of chart series.

I assume that results should be filtered according to resultsFilterStartDateTime and resultsFilterEndDateTime parameters. Unfortunately they are being overwriten.

I debugged listResults.php script and apparently it happens around 45 and 50 line.

Artur Sudnik
Find all posts by this user
Quote this message in a reply
10-21-2011, 01:09 AM
Post: #2
RE: Results filtering after clicking on chart
I've done, and am continuing to do, a lot of cleanup of bugs and warning messages. I tested the latest version from trunk and it seems to have fixed this issue.

But... If you do pull trunk, please keep an eye out for any bugs that I may have introduced while working on cleaning up the php warning messages. Hopefully I didn't add more bugs than I deleted, but you never now.

I appreciate your help in squashing the bugs.

Tony Perkins
Find all posts by this user
Quote this message in a reply
10-21-2011, 01:15 AM
Post: #3
RE: Results filtering after clicking on chart
I work on HEAD version of trunk.

Following is modified listResults.php file that seems to work correctly for me:


<?php
require("login/login.php");
include 'monitor.inc';
global $wptResultStatusCodes;
date_default_timezone_set($_SESSION['ls_timezone']);

//$_REQUEST['folderId'];
$user_id = getCurrentUserId();

// Defaults
$resultsFilterField="";
$resultsFilterValue="";

// Handle resultsFilter settings
// TODO: Refactor filter feature into common code. It's duplicated
if (isset($_REQUEST['clearFilter'])) {
unset($_SESSION['resultsFilterField']);
unset($_SESSION['resultsFilterValue']);
unset($_SESSION['resultsFilterStartDateTime']);
unset($_SESSION['resultsFilterEndDateTime']);
} else {
if (isset($_REQUEST['filterField']) && $resultsFilterField = $_REQUEST['filterField']) {
$_SESSION['resultsFilterField'] = $resultsFilterField;
}
if (isset($_REQUEST['filterValue']) && $resultsFilterValue = $_REQUEST['filterValue']) {
$_SESSION['resultsFilterValue'] = $resultsFilterValue;
}
}
if ( isset($_SESSION['resultsFilterField'])){
$resultsFilterField = $_SESSION['resultsFilterField'];
}
if ( isset($_SESSION['resultsFilterValue'])){
$resultsFilterValue = $_SESSION['resultsFilterValue'];
}
if ( isset($_REQUEST['startDateTime'])){
$startDateTime = $_REQUEST['startDateTime'];
} else {
if (isset($_REQUEST['startMonth'])) {
$startDateTime = mktime($_REQUEST['startHour'], $_REQUEST['startMinute'], 0, $_REQUEST['startMonth'], $_REQUEST['startDay'], $_REQUEST['startYear']);
} else if (isset($_SESSION['resultsFilterStartDateTime'])) {
$startDateTime = $_SESSION['resultsFilterStartDateTime'];
}
}
if ( isset($_REQUEST['endDateTime'])){
$endDateTime = $_REQUEST['endDateTime'];
} else {
if (isset($_REQUEST['endMonth'])) {
$endDateTime = mktime($_REQUEST['endHour'], $_REQUEST['endMinute'], 0, $_REQUEST['endMonth'], $_REQUEST['endDay'], $_REQUEST['endYear']);
} else if (isset($_SESSION['resultsFilterEndDateTime'])) {
$endDateTime = $_SESSION['resultsFilterEndDateTime'];
}
}

if (!isset($startDateTime) && !isset($_SESSION['resultsFilterStartDateTime'])) {
$startDateTime = time() - 86400;
}
if (!isset($endDateTime) && !isset($_SESSION['resultsFilterEndDateTime'])) {
$endDateTime = time();
}

$_SESSION['resultsFilterStartDateTime'] = $startDateTime;
$_SESSION['resultsFilterEndDateTime'] = $endDateTime;

$smarty->assign('startTime', $startDateTime);
$smarty->assign('endTime', $endDateTime);

if (isset($_REQUEST['job_id'])){
$job_id = $_REQUEST['job_id'];
$ownerId= getOwnerIdFor($job_id,'WPTJob');
} else {
$ownerId = null;
}

// If a job_id is passed in, set the filter to show only results for that job_id
if (isset($job_id)) {
$_SESSION['resultsFilterField'] = "WPTJob.Id";
$_SESSION['resultsFilterValue'] = $job_id[0];
}

if (isset($_REQUEST['showResultsThumbs']) && $showThumbs = $_REQUEST['showResultsThumbs']) {
$_SESSION['showResultsThumbs'] = $showThumbs;
} else if (!isset($_SESSION['showResultsThumbs'])) {
$_SESSION['showResultsThumbs'] = 'false';
}
$smarty->assign('showResultsThumbs', $_SESSION['showResultsThumbs']);

if (isset($_REQUEST['showWaterfallThumbs']) && $showWaterfallThumbs = $_REQUEST['showWaterfallThumbs']) {
$_SESSION['showWaterfallThumbs'] = $showWaterfallThumbs;
} else if (!isset($_SESSION['showWaterfallThumbs'])) {
$_SESSION['showWaterfallThumbs'] = 'false';
}

$smarty->assign('showWaterfallThumbs', $_SESSION['showWaterfallThumbs']);

// Handle pager settings
if (isset($_REQUEST['currentPage'])) {
$_SESSION['resultsCurrentPage'] = $_REQUEST['currentPage'];
}
if (!isset($_SESSION['resultsCurrentPage'])) {
$_SESSION['resultsCurrentPage'] = 1;
}
$resultsCurrentPage = $_SESSION['resultsCurrentPage'];

// Order by direction
if (isset($_REQUEST['orderByDir']) && ($orderByDir = $_REQUEST['orderByDir'])) {
$_SESSION['orderResultsByDirection'] = $orderByDir;
} else {
if (!isset($_SESSION['orderResultsByDirection'])) {
$_SESSION['orderResultsByDirection'] = "DESC";
}
}
if ($_SESSION['orderResultsByDirection'] == "ASC") {
$orderByDirInv = "DESC";
} else {
$orderByDirInv = "ASC";
}

// Order by
if (!isset($_REQUEST['orderBy'])) {
if (!isset($_SESSION['orderResultsBy'])) {
$orderBy = "Date";
} else {
$orderBy = $_SESSION['orderResultsBy'];
}
} else {
$orderBy = $_REQUEST['orderBy'];
}
$_SESSION['orderResultsBy'] = $orderBy;

$smarty->assign('orderResultsBy', $_SESSION['orderResultsBy']);
$smarty->assign('orderResultsByDirection', $_SESSION['orderResultsByDirection']);
$smarty->assign('orderResultsByDirectionInv', $orderByDirInv);
$smarty->assign('resultsFilterField', $resultsFilterField);
$smarty->assign('resultsFilterValue', $resultsFilterValue);

$orderBy = 'r.' . $_SESSION['orderResultsBy'] . ' ' . $_SESSION['orderResultsByDirection'];
// Get list of job folders that this user has at least read rights to
$folderShares = getFolderShares($user_id,'WPTJob',$ownerId);
$folderIds = array();
foreach ($folderShares as $key=>$folderShare){
foreach ($folderShare as $k=>$share){
$folderIds[] = $k;
}
}
try
{
$q = Doctrine_Query::create()->from('WPTResult r, r.WPTJob j')->orderBy($orderBy);

if ($folderIds) {
$q->whereIn('r.WPTJob.WPTJobFolderId', $folderIds);
} else {
// $q->andWhere('s.UserId = ?', $user_id);
$q->andWhere('r.WPTJob.UserId = ?', $user_id);
}

if ($resultsFilterField && $resultsFilterValue) {
if ($resultsFilterField == "WPTJob.Id") {
$q->andWhere('r.' . $resultsFilterField . '= ?', $resultsFilterValue)
->andWhere('r.Date < ?', $endDateTime)
->andWhere('r.Date > ?', $startDateTime);
} else {
$q->andWhere('r.' . $resultsFilterField . ' LIKE ?', '%' . $resultsFilterValue . '%')
->andWhere('r.Date < ?', $endDateTime)
->andWhere('r.Date > ?', $startDateTime);
}
} else {
$q->andWhere('r.Date < ?', $endDateTime)
->andWhere('r.Date > ?', $startDateTime);
}
$pager = new Doctrine_Pager($q, $resultsCurrentPage, $resultsPerPage);
$result = $pager->execute();
$smarty->assign('wptResultURL', $wptResult);
$smarty->assign('currentPage', $resultsCurrentPage);
$smarty->assign('maxpages', $pager->getLastPage());
$smarty->assign('result', $result);
$smarty->assign('statusCodes', $wptResultStatusCodes);

}
catch (Exception $e)
{
error_log("[WPTMonitor] Failed while Listing jobs: " . $wptResultId . " message: " . $e->getMessage());
print 'Exception : ' . $e->getMessage();
}
unset($pager);
unset($result);
$smarty->display('job/listResults.tpl');

?>
Find all posts by this user
Quote this message in a reply
10-22-2011, 02:07 AM
Post: #4
RE: Results filtering after clicking on chart
Thank you. I applied these changes to trunk.

Tony Perkins
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)