Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Added approval editor table to front door (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
lanthe authored and lanthe committed Mar 16, 2014
1 parent 7e94c54 commit 38d776e
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 17 deletions.
9 changes: 8 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,20 @@ th.puzz-stats, td.puzz-stats {
padding-top: 0.1em;
}

th.ed-stats, td.ed-stats {
th.approval-ed-stats, td.approval-ed-stats {
background-color: #B4C1E0;
border: none;
padding-bottom: 0.1em;
padding-top: 0.1em;
}

th.discussion-ed-stats, td.discussion-ed-stats {
background-color: #E4C4BA;
border: none;
padding-bottom: 0.1em;
padding-top: 0.1em;
}

th.p-stats, td.p-stats {
background-color: #E0E0B4;
border: none;
Expand Down
58 changes: 45 additions & 13 deletions html.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,15 @@ function displayPuzzleStats($uid)
{
$max_rows = 6;



$totalNumberOfPuzzles = count(getAllLivePuzzles());
$numberOfEditors = getNumberOfEditorsOnPuzzles();
$numberOfEditors = getNumberOfEditorsOnPuzzles("discuss");
$moreThanThree = $totalNumberOfPuzzles - $numberOfEditors['0'] - $numberOfEditors['1'] - $numberOfEditors['2'] - $numberOfEditors['3'];

$numberOfApprovalEditors = getNumberOfEditorsOnPuzzles("approval");
$moreThanThreeApproval = $totalNumberOfPuzzles - $numberOfApprovalEditors['0'] - $numberOfApprovalEditors['1'] - $numberOfApprovalEditors['2'] - $numberOfApprovalEditors['3'];

$userNumbers = getNumberOfPuzzlesForUser($uid);

$editor = $userNumbers['editor'];
Expand Down Expand Up @@ -378,30 +383,57 @@ function displayPuzzleStats($uid)
</tr>
</table>
</td>
<td class="ed-stats">
<td class="discussion-ed-stats">
<table>
<tr>
<th class="discussion-ed-stats" colspan="2">Discuss Eds</th>
</tr>
<tr>
<td class="discussion-ed-stats">Zero</td>
<td class="discussion-ed-stats"><?php echo $numberOfEditors['0']; ?></td>
</tr>
<tr>
<td class="discussion-ed-stats">One</td>
<td class="discussion-ed-stats"><?php echo $numberOfEditors['1']; ?></td>
</tr>
<tr>
<td class="discussion-ed-stats">Two</td>
<td class="discussion-ed-stats"><?php echo $numberOfEditors['2']; ?></td>
</tr>
<tr>
<td class="discussion-ed-stats">Three</td>
<td class="discussion-ed-stats"><?php echo $numberOfEditors['3']; ?></td>
</tr>
<tr>
<td class="discussion-ed-stats">&gt;Three</td>
<td class="discussion-ed-stats"><?php echo $moreThanThree; ?></td>
</tr>
</table>
</td>
<td class="approval-ed-stats">
<table>
<tr>
<th class="ed-stats" colspan="2">Num of Editors</th>
<th class="approval-ed-stats" colspan="2">Approval Eds</th>
</tr>
<tr>
<td class="ed-stats">Zero</td>
<td class="ed-stats"><?php echo $numberOfEditors['0']; ?></td>
<td class="approval-ed-stats">Zero</td>
<td class="approval-ed-stats"><?php echo $numberOfApprovalEditors['0']; ?></td>
</tr>
<tr>
<td class="ed-stats">One</td>
<td class="ed-stats"><?php echo $numberOfEditors['1']; ?></td>
<td class="approval-ed-stats">One</td>
<td class="approval-ed-stats"><?php echo $numberOfApprovalEditors['1']; ?></td>
</tr>
<tr>
<td class="ed-stats">Two</td>
<td class="ed-stats"><?php echo $numberOfEditors['2']; ?></td>
<td class="approval-ed-stats">Two</td>
<td class="approval-ed-stats"><?php echo $numberOfApprovalEditors['2']; ?></td>
</tr>
<tr>
<td class="ed-stats">Three</td>
<td class="ed-stats"><?php echo $numberOfEditors['3']; ?></td>
<td class="approval-ed-stats">Three</td>
<td class="approval-ed-stats"><?php echo $numberOfApprovalEditors['3']; ?></td>
</tr>
<tr>
<td class="ed-stats">&gt;Three</td>
<td class="ed-stats"><?php echo $moreThanThree; ?></td>
<td class="approval-ed-stats">&gt;Three</td>
<td class="approval-ed-stats"><?php echo $moreThanThreeApproval; ?></td>
</tr>
</table>
</td>
Expand Down
12 changes: 9 additions & 3 deletions utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -3156,11 +3156,17 @@ function getRoundForPuzzle($pid)
return get_rows($sql);
}

function getNumberOfEditorsOnPuzzles()
function getNumberOfEditorsOnPuzzles($type)
{
if ($type == "discuss") {
$queue = "editor_queue";
} else {
$queue = "approver_queue";
}

$deadstatusid = getDeadStatusId();
$sql = sprintf('SELECT COUNT(editor_queue.uid) FROM puzzle_idea
LEFT JOIN editor_queue ON puzzle_idea.id=editor_queue.pid WHERE puzzle_idea.pstatus != %d
$sql = sprintf('SELECT COUNT('.$queue.'.uid) FROM puzzle_idea
LEFT JOIN '.$queue.' ON puzzle_idea.id='.$queue.'.pid WHERE puzzle_idea.pstatus != %d
GROUP BY id', $deadstatusid);
$numbers = get_elements($sql);

Expand Down

0 comments on commit 38d776e

Please sign in to comment.