git.shiar.nl
/
minimedit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dffe1a6
)
issue: count number of replies in overview
author
Mischa POSLAWSKY
<perl@shiar.org>
Fri, 8 Nov 2019 00:21:45 +0000
(
01:21
+0100)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Mon, 18 Nov 2019 17:13:27 +0000
(18:13 +0100)
issue/index.php
patch
|
blob
|
history
diff --git
a/issue/index.php
b/issue/index.php
index e7c69bb49de71088c48f8927dc2b3035685659a9..f950861f98c4181e459e9cb1cbe925b1637baf7c 100644
(file)
--- a/
issue/index.php
+++ b/
issue/index.php
@@
-51,7
+51,9
@@
if ($_POST) {
$_POST = [];
}
$_POST = [];
}
-$sql = 'SELECT * FROM issues WHERE page = ?';
+$cols = "*, (SELECT count(*) FROM comments WHERE"
+ . " page=i.page||'/'||i.id AND message IS NOT NULL) AS replycount";
+$sql = "SELECT $cols FROM issues i WHERE page = ?";
if (isset($_GET['open'])) {
$sql .= ' AND closed IS NULL';
}
if (isset($_GET['open'])) {
$sql .= ' AND closed IS NULL';
}
@@
-66,7
+68,10
@@
while ($row = $query->fetch()) {
sprintf($row->closed ? '<strike>%s</strike>' : '%s',
htmlspecialchars($row->subject)),
showdate(array_slice(preg_split('/\D/', $row->updated), 0, 3)),
sprintf($row->closed ? '<strike>%s</strike>' : '%s',
htmlspecialchars($row->subject)),
showdate(array_slice(preg_split('/\D/', $row->updated), 0, 3)),
- isset($row->assign) ? ' <em class="right">'.$row->assign.'</em>' : ''
+ implode(' ', [
+ $row->replycount ? sprintf('<span class=right>+%d</span>', $row->replycount) : '',
+ isset($row->assign) ? ' <em class="right">'.$row->assign.'</em>' : '',
+ ])
);
print "</li>\n";
}
);
print "</li>\n";
}