Skip to content

Commit

Permalink
Use AssignmentCountSet more often for consistency.
Browse files Browse the repository at this point in the history
Report review counts as computed by it.
  • Loading branch information
kohler committed Nov 12, 2020
1 parent 3d07d6c commit e5a77c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 31 deletions.
28 changes: 8 additions & 20 deletions assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,17 +449,7 @@ function pcAssignments($qreq) {

// PC assignments
if ($Me->can_administer($prow)) {
$result = $Conf->qe("select ContactInfo.contactId, allReviews
from ContactInfo
left join (select contactId, group_concat(reviewType separator '') allReviews
from PaperReview join Paper using (paperId)
where reviewType>=" . REVIEW_PC . " and timeSubmitted>=0
group by contactId) A using (contactId)
where ContactInfo.roles!=0 and (ContactInfo.roles&" . Contact::ROLE_PC . ")!=0");
$pcx = [];
while (($row = $result->fetch_object())) {
$pcx[$row->contactId] = $row;
}
$acs = AssignmentCountSet::load($Me, AssignmentCountSet::HAS_REVIEW);

// PC conflicts row
echo '<div class="pcard revcard">',
Expand All @@ -481,7 +471,6 @@ function pcAssignments($qreq) {
$tagger = new Tagger($Me);

foreach ($Conf->full_pc_members() as $pc) {
$p = $pcx[$pc->contactId];
if (!$pc->can_accept_review_assignment_ignore_conflict($prow)) {
continue;
}
Expand Down Expand Up @@ -540,18 +529,17 @@ function pcAssignments($qreq) {

// then, number of reviews
echo '<div class="pctbnrev">';
$numReviews = strlen($p->allReviews);
$numPrimary = substr_count($p->allReviews, (string) REVIEW_PRIMARY);
if (!$numReviews) {
$ac = $acs->get($pc->contactId);
if ($ac->rev === 0) {
echo "0 reviews";
} else {
echo '<a class="q" href="',
hoturl("search", "q=re:" . urlencode($pc->email)), '">',
plural($numReviews, "review"), "</a>";
if ($numPrimary && $numPrimary < $numReviews) {
$Conf->hoturl("search", "q=re:" . urlencode($pc->email)), '">',
plural($ac->rev, "review"), "</a>";
if ($ac->pri && $ac->pri < $ac->rev) {
echo '&nbsp; (<a class="q" href="',
hoturl("search", "q=pri:" . urlencode($pc->email)),
"\">$numPrimary primary</a>)";
$Conf->hoturl("search", "q=pri:" . urlencode($pc->email)),
"\">{$ac->pri} primary</a>)";
}
}
echo "</div></div></div>\n"; // .pctbnrev .ctelti .ctelt
Expand Down
13 changes: 2 additions & 11 deletions manualassign.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,23 +155,14 @@ function saveAssignments($qreq, $reviewer) {
Ht::form(hoturl("manualassign"), array("method" => "get", "id" => "selectreviewerform"));
Ht::stash_script('hotcrp.highlight_form_children("#selectreviewerform")');

$result = $Conf->qe_raw("select ContactInfo.contactId, count(reviewId)
from ContactInfo
left join PaperReview on (PaperReview.contactId=ContactInfo.contactId and PaperReview.reviewType>=" . REVIEW_SECONDARY . ")
where roles!=0 and (roles&" . Contact::ROLE_PC . ")!=0
group by ContactInfo.contactId");
$rev_count = [];
while (($row = $result->fetch_row())) {
$rev_count[$row[0]] = $row[1];
}

$acs = AssignmentCountSet::load($Me, AssignmentCountSet::HAS_REVIEW);
$rev_opt = array();
if (!$reviewer) {
$rev_opt[0] = "(Select a PC member)";
}
foreach ($Conf->pc_members() as $pc) {
$rev_opt[$pc->email] = htmlspecialchars($pc->name(NAME_P|NAME_S)) . " ("
. plural(get($rev_count, $pc->contactId, 0), "assignment") . ")";
. plural($acs->get($pc->contactId)->rev, "assignment") . ")";
}

echo "<table><tr><td><strong>PC member:</strong> &nbsp;</td>",
Expand Down

0 comments on commit e5a77c5

Please sign in to comment.