changeset 490:e4b929e40fa8

Add feature of limiting date range of POST count
author HIROSE Yuuji <yuuji@gentei.org>
date Fri, 08 Jun 2018 09:36:21 +0900
parents 075897fee2c0
children c5d6e12306d4
files s4-funcs.sh
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/s4-funcs.sh	Mon May 28 10:39:32 2018 +0900
+++ b/s4-funcs.sh	Fri Jun 08 09:36:21 2018 +0900
@@ -2458,14 +2458,22 @@
       fi
     fi
   fi
+  # POST count summary
+  from=`getpar from`; to=`getpar to`
+  from_input="<input type=\"date\" name=\"from\" placeholder=\"YYYY-MM-DD\" value=\"${from}\">"
+  to_input="<input type=\"date\" name=\"to\" value=\"${to:-9999}\">"
+  fromtonote="<p>POST集計: $from_input - $to_input</p>$from - $to"
   # New entry
   sql="WITH mems AS (
 	  SELECT g.rowid, name, gecos FROM grp_mem gm LEFT JOIN gecoses g
 	  ON gm.user=g.name
 	  WHERE gname=(SELECT gname FROM grp WHERE rowid=$grid)
+	), target_article AS (
+	  SELECT id FROM article_s
+	  WHERE key='ctime' AND val BETWEEN '${from:-0000}' AND '${to:-9999}'
 	), posts AS (
   	  SELECT author, count(author) post
-	  FROM article NATURAL JOIN article_s
+	  FROM article NATURAL JOIN article_s NATURAL JOIN target_article
   	  WHERE blogid IN (SELECT id FROM blog_s
                    WHERE key='owner'
                    AND val=(SELECT gname FROM grp WHERE rowid=$grid))
@@ -2552,7 +2560,7 @@
 ${isowner:+$cmmsg$excmsg}
 `cgi_radio rm close id="x"`<label for="x">×</label>
 </div>
-<h4>$grp 参加者一覧</h4>
+<h4>$grp 参加者一覧</h4>$fromtonote
 <table class="td2r">
 `sq $db -header -html "$sql"`
 </table>

yatex.org