Skip to content

Commit

Permalink
[Conflict Resolver] Display Examiner's full_name rather than examiner…
Browse files Browse the repository at this point in the history
…ID (#2891)

Conflict Resolver displays the examinerID for conflicts in the Examiner field making it difficult / impossible for anyone doing conflict resolution to resolve this field.

This modifies it to use the examiner's full name.
  • Loading branch information
davidblader authored and driusan committed Jun 21, 2017
1 parent f460ad7 commit c0bdd48
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,75 @@ class NDB_Menu_Filter_Form_Conflict_Resolver extends NDB_Menu_Filter_Form

return true;
}
/**
* Returns a list of candidates, users, etc.
* Need override for when Examiner field is conflicting,
* need Examiner's full name
*
* @return array
* @access private
*/
function _getFullList()
{
// create DB object
$DB =& Database::singleton();

$qparams = array();
// add the base query
$query = '';
$query .= $this->_getBaseQuery();

$filterdetails = $this->_getBaseFilter();
$query .= $filterdetails['clause'];
$qparams = $filterdetails['params'];
// apply ORDER BY filters
$query .= " ORDER BY ";
if (!empty($this->filter['order'])) {
$query .= $this->filter['order']['field']
." ".$this->filter['order']['fieldOrder'].", ";
}
$query .= $this->order_by;
// get the list

$pageNum = 1;
if (isset($_REQUEST['pageID'])) {
$pageNum = $_REQUEST['pageID'];
}

$this->_getNumberPages($query);

$config =& NDB_Config::singleton();
$resultsPerPage = $config->getSetting('rowsPerPage');
$limit = " LIMIT $resultsPerPage"
." OFFSET " . (($pageNum-1)*$resultsPerPage);
$result = $DB->pselect($query . $limit, $qparams);

// OVERRIDE START
foreach ($result as $k => $r) {
if ($r['Question'] === 'Examiner') {
if (!empty($r['Value1'])) {
$r['Value1'] = $DB->pselectOne(
'SELECT full_name
FROM examiners
WHERE examinerID=:eid',
array('eid' => $r['Value1'])
);
}
if (!empty($r['Value2'])) {
$r['Value2'] = $DB->pselectOne(
'SELECT full_name
FROM examiners
WHERE examinerID=:eid',
array('eid' => $r['Value2'])
);
}
$result[$k] = $r;
}
}
//OVERRIDE END

return $result;
}
/**
* Gathers JS dependecies and merge them with the parent
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,67 @@ class NDB_Menu_Filter_Resolved_Conflicts extends NDB_Menu_Filter
return true;
}

/**
* Returns a list of candidates, users, etc.
* Need override for when Examiner field is conflicting,
* need Examiner's full name
*
* @return array
* @access private
*/
function _getFullList()
{
// create DB object
$DB =& Database::singleton();

$qparams = array();
// add the base query
$query = '';
$query .= $this->_getBaseQuery();

$filterdetails = $this->_getBaseFilter();
$query .= $filterdetails['clause'];
$qparams = $filterdetails['params'];
// apply ORDER BY filters
$query .= " ORDER BY ";
if (!empty($this->filter['order'])) {
$query .= $this->filter['order']['field']
." ".$this->filter['order']['fieldOrder'].", ";
}
$query .= $this->order_by;
// get the list

$pageNum = 1;
if (isset($_REQUEST['pageID'])) {
$pageNum = $_REQUEST['pageID'];
}

$this->_getNumberPages($query);

$config =& NDB_Config::singleton();
$resultsPerPage = $config->getSetting('rowsPerPage');
$limit = " LIMIT $resultsPerPage"
." OFFSET " . (($pageNum-1)*$resultsPerPage);
$result = $DB->pselect($query . $limit, $qparams);
// OVERRIDE START
foreach ($result as $k => $r) {
if ($r['Question'] === 'Examiner') {
if (!empty($r['CorrectAnswer'])) {
$r['CorrectAnswer'] = $DB->pselectOne(
'SELECT full_name
FROM examiners
WHERE examinerID=:eid',
array('eid' => $r['CorrectAnswer'])
);
}
$result[$k] = $r;
}
}
//OVERRIDE END

return $result;
}

/**
* Gathers JS dependecies and merge them with the parent
*
Expand Down

0 comments on commit c0bdd48

Please sign in to comment.