'Weighted Topic Match', 'description' => 'Assigns based on number of topic matches (high to low) between submissions and reviewers, giving assignment precedence to submissions with the least number of overall matching reviewer/topic pairings', 'include' => 'assign_auto_advocates_weighted_topic_match.inc' ), array( 'algorithm' => 'Topic Match', 'description' => 'Assigns based on number of topic matches (high to low) between submissions and reviewers', 'include' => 'assign_auto_advocates_topic_match.inc' ), ); function oc_skipSubAssignment($sid) { $skip = false; // skip if accepted if (isset($_POST['skipaccepted']) && ($_POST['skipaccepted'] == 'Yes') && isset($GLOBALS['pInfoAR'][$sid]['accepted']) && !empty($GLOBALS['pInfoAR'][$sid]['accepted'])) { $skip = true; } //skip if not of the selected type if (isset($_POST['limittype']) && !empty($_POST['limittype']) && isset($GLOBALS['pInfoAR'][$sid]['type']) && ($_POST['limittype'] != $GLOBALS['pInfoAR'][$sid]['type'])) { $skip = true; } return($skip); } // Check for addt'l (hook) algorithms if (oc_hookSet('assign_auto_advocates-algorithm')) { foreach ($OC_hooksAR['assign_auto_advocates-algorithm'] as $k => $v) { $OC_algorithmAR[] = $v; } } // Submit - Commit assignments to database? if (isset($_POST['submit']) && ($_POST['submit'] == "Make Assignments")) { // Check for valid submission if (!validToken('chair')) { warn('Invalid submission'); } if (!isset($_SESSION['OPENCONFCHAIRVARS']['aAssignments'])) { err("No advocates set"); } // Keep or delete current assignments $currAR = array(); if ($_POST['keep'] == 'Yes') { $aq = "SELECT `paperid`, `advocateid` FROM `" . OCC_TABLE_PAPERADVOCATE . "`"; $ar = ocsql_query($aq) or err("Unable to access database"); while ($al = ocsql_fetch_array($ar)) { $currAR[] = $al['paperid'] . '-' . $al['advocateid']; } } else { oc_deleteAssignments(null, null, 'advocate'); } // Add advocates foreach ($_SESSION['OPENCONFCHAIRVARS']['aAssignments'] as $pid => $aid) { if (!$aid || in_array($pid . '-' . $aid, $currAR)) { continue; } $q = "INSERT INTO `" . OCC_TABLE_PAPERADVOCATE . "` (`paperid`,`advocateid`) VALUES ('" . safeSQLstr($pid) . "','" . safeSQLstr($aid) . "')"; issueSQL($q); } // Okey Dokey print '
Assignments have been made
'; unset($_SESSION['OPENCONFCHAIRVARS']['aAssignments']); printFooter(); exit; } // Check whether any reviewers or advocates assigned yet $aq = "SELECT `paperid`, `advocateid` FROM `" . OCC_TABLE_PAPERADVOCATE . "`"; $ar = ocsql_query($aq) or err("Unable to access database"); $patot = ocsql_num_rows($ar); $q = "SELECT count(*) as `rtot` FROM `" . OCC_TABLE_PAPERREVIEWER . "`"; $r = ocsql_query($q) or err("Unable to access database"); $rl = ocsql_fetch_array($r); if (($patot > 0) || ($rl['rtot'] > 0)) { print 'Advocates or Reviewers appear to have already been assigned. Existing advocate assignments will be deleted unless you choose Yes to Keep Existing Assignments below.
'; $confirmOverride = true; } else { $confirmOverride = false; } // Get number of papers and initialize paper count array $pAR = array(); // paper advocate array $pInfoAR = array(); // paper info array $q = "SELECT `paperid`, `title`, `accepted`, `type` FROM `" . OCC_TABLE_PAPER . "` ORDER BY `paperid`"; $r = ocsql_query($q) or err("Unable to get papers ".ocsql_errno()); if (($ptot = ocsql_num_rows($r)) == 0) { warn('No submissions have been made yet.'); } while ($l=ocsql_fetch_array($r)) { $pAR[$l['paperid']] = ""; $pInfoAR[$l['paperid']] = array( 'title' => $l['title'], 'accepted' => $l['accepted'], 'type' => $l['type'] ); } // Get number of advocates and initialize advocate count array $aNameAR = array(); // advocate name array $aAR = array(); // advocate papers array $q = "SELECT `reviewerid`, CONCAT_WS(' ',`" . OCC_TABLE_REVIEWER . "`.`name_first`,`" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name` FROM `" . OCC_TABLE_REVIEWER . "` WHERE `onprogramcommittee`='T' ORDER BY `reviewerid`"; $r = ocsql_query($q) or err("Unable to get advocates ".ocsql_errno()); if (($atot = ocsql_num_rows($r)) == 0) { warn('No program committee members have signed up yet.'); } while ($l=ocsql_fetch_array($r)) { $aAR[$l['reviewerid']] = array(); $aNameAR[$l['reviewerid']] = $l['name']; } // Get conflicts $nAR = getConflicts(); // Calculate max # of papers each advocate should advocate (pronunciation test) if (isset($_POST['ppa']) && preg_match("/^\d+$/",$_POST['ppa'])) { $papersPerAdvocate = $_POST['ppa']; } else { $papersPerAdvocate = ceil($ptot/$atot); # +count($nAR) to $ptot ? } // Set min # of papers each advocate should be assigned if (isset($_POST['ppat']) && preg_match("/^\d+$/",$_POST['ppat'])) { $ppaThreshold = $_POST['ppat']; } else { $ppaThreshold = floor($papersPerAdvocate/2); } // Keep assignments already made? if (!isset($_POST['keep']) || ($_POST['keep'] == 'Yes')) { $confirmOverride = false; if ($patot > 0) { while ($al = ocsql_fetch_array($ar)) { $pAR[$al['paperid']] = $al['advocateid']; array_push($aAR[$al['advocateid']],$al['paperid']); } } } // Get list of sub. types $OC_activeSubTypeAR = array(); $typer = ocsql_query("SELECT DISTINCT `type` FROM `" . OCC_TABLE_PAPER . "` WHERE `type` IS NOT NULL AND `type`!='' ORDER BY `type`") or err('Unable to retrieve submission types'); while ($typel = ocsql_fetch_assoc($typer)) { $OC_activeSubTypeAR[$typel['type']] = substr($typel['type'], 0, 50); } // Algorithm to use if (isset($_POST['algo']) && ctype_digit($_POST['algo'])) { $algo = $_POST['algo']; } else { $algo = 0; // default to first defined algorithm above } // Run algo if (isset($OC_algorithmAR[$algo]['include']) && is_file($OC_algorithmAR[$algo]['include'])) { require_once $OC_algorithmAR[$algo]['include']; } else { err("Algorithm choice unknown"); exit; } // Remedy missing advocates by assigning advocates w/lowest #s (if set) if (isset($_POST['remedy']) && in_array("random",$_POST['remedy'])) { foreach (array_keys($pAR) as $k) { if (oc_skipSubAssignment($k)) { continue; } if (empty($pAR[$k])) { // Create an ordered array of advocates w/least # of reviews $acountAR = array(); foreach (array_keys($aAR) as $k2) { $acountAR[$k2] = count($aAR[$k2]); } asort($acountAR); reset($acountAR); // Assign advocate while (key($acountAR) && empty($pAR[$k])) { // check for no conflict if (!in_array($k.'-'.key($acountAR),$nAR)) { $pAR[$k] = key($acountAR); array_push($aAR[key($acountAR)],$k); } next($acountAR); } } } } // Remember assignments $_SESSION['OPENCONFCHAIRVARS']['aAssignments'] = $pAR; // Display form print 'Below you will find OpenConf\'s suggested advocate assignments. You may fine tune these automated assignments by changing the following options and clicking Re-Evaluate Assignments. Once you are satisfied, click the Make Assignments button to commit them to the database. You may manually add/delete advocates afterwards through the Assign Advocates Manually and List/Unassign Advocates menus.'; if (oc_moduleValid('oc_auto_assign')) { print ' If instead of using this feature you would like assignments to be made automatically when a new submission is made, use the Auto Assign module.'; } print '
'; function fmtNumSpacing ($n,$dir="l") { $sp = ""; if ($n < 10) { $sp = " "; } elseif ($n < 100) { $sp = " "; } if ($dir=="l") { return($sp.$n); } else { return($n.$sp); } } function fmtStrSpacing ($str,$len) { $a = substr($str,0,$len); for ($i=oc_strlen($a); $i<$len; $i++) { $a .= " "; } return $a; } print '
Suggested Assignments' . ((!isset($_POST['keep']) || ($_POST['keep'] == 'Yes')) ? 'including already assigned' : '') . ' | ||
---|---|---|
* Unable to assign advocate Click title for submission info (new window) Submission ID (Title) (Advocate) '; foreach ($pAR as $k => $v) { $tmpStr = fmtNumSpacing($k).' (' . safeHTMLstr(fmtStrSpacing($pInfoAR[$k]['title'], 20)) . ") ("; if (!empty($v)) { $tmpStr .= safeHTMLstr(fmtStrSpacing($pAR[$k] . "-" . $aNameAR[$pAR[$k]],15)); print $tmpStr.")\n"; } else { $tmpStr .= fmtStrSpacing("",15); print '' . $tmpStr . ") *\n"; } } print ' | * below threshold Click name for reviewer info (new window) Place cursor on No. Submissions for assignments No. Submissions per Advocate ID (Name) '; foreach ($aAR as $k => $v) { $titleStr = "Submissions for Advocate $k - " . $aNameAR[$k] . ":\n\n"; foreach ($v as $vv) { $titleStr .= "$vv - ". safeHTMLstr(substr($pInfoAR[$vv]['title'],0,40))."\n"; } $tmpStr = '' . fmtNumSpacing(count($v)) . " - " . fmtNumSpacing($k) . '' . safeHTMLstr($titleStr) . ' (' . safeHTMLstr(fmtStrSpacing($aNameAR[$k],25)).")"; if (count($v) <= $ppaThreshold) { print ''.$tmpStr." *\n"; } else { print $tmpStr . "\n"; } } print " |