Re-add count of votes in polls admin page

This commit is contained in:
Olivier PEREZ 2015-01-18 16:30:02 +01:00
parent f6a7a1c7bb
commit cbad43614d
2 changed files with 7 additions and 2 deletions

View File

@ -283,7 +283,12 @@ class FramaDB {
*/
public function findAllPolls($start, $limit) {
// Polls
$prepared = $this->prepare('SELECT * FROM ' . Utils::table('poll') . ' ORDER BY title ASC LIMIT :start, :limit');
$prepared = $this->prepare('
SELECT p.*,
(SELECT count(1) FROM ' . Utils::table('vote') . ' v WHERE p.id=v.poll_id) votes
FROM ' . Utils::table('poll') . ' p
ORDER BY p.title ASC
LIMIT :start, :limit');
$prepared->bindParam(':start', $start, PDO::PARAM_INT);
$prepared->bindParam(':limit', $limit, PDO::PARAM_INT);
$prepared->execute();

View File

@ -52,7 +52,7 @@
{else}
<td><span class="text-danger">{strtotime($poll->end_date)|date_format:'d/m/Y'}</span></td>
{/if}
<td>TODO</td>
<td>{$poll->votes|html}</td>
<td>{$poll->id|html}</td>
<td><a href="{$poll->id|poll_url|html}" class="btn btn-link" title="{_('See the poll')}"><span class="glyphicon glyphicon-eye-open"></span><span class="sr-only">{_('See the poll')}</span></a></td>
<td><a href="{$poll->admin_id|poll_url:true|html}" class="btn btn-link" title="{_('Change the poll')}"><span class="glyphicon glyphicon-pencil"></span><span class="sr-only">{_('Change the poll')}</span></a></td>