s4

changeset 176:2194af7e96f3

Tbl of collecting time of acclog for listnewblogs should be 'blog'
author HIROSE Yuuji <yuuji@gentei.org>
date Sat, 20 Feb 2016 00:02:00 +0859
parents 3d12521876f2
children 1adafaf079a0
files s4-funcs.sh
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/s4-funcs.sh	Fri Feb 19 22:00:01 2016 +0859
     1.2 +++ b/s4-funcs.sh	Sat Feb 20 00:02:00 2016 +0859
     1.3 @@ -425,6 +425,7 @@
     1.4    if [ -n "$2" ]; then
     1.5      now=`date +"%F %T"`
     1.6      query "replace into acclog values('$user', '$1', '$2', '$now');"
     1.7 +    #query "replace into acclog values('$user', '$1', $2, '$now');"
     1.8    fi
     1.9  }
    1.10  gecos() (
    1.11 @@ -1343,7 +1344,7 @@
    1.12    showgroup "$grid"
    1.13  }
    1.14  listnewblogsql() { # $1=user
    1.15 -  cat<<EOF
    1.16 +  tee tmp/sql.out<<EOF
    1.17  with article_ctime as (
    1.18    select id,blogid,author,val ctime
    1.19    from article join article_s s using(id)
    1.20 @@ -1354,7 +1355,7 @@
    1.21          max(case key when 'owner' then val end) owner
    1.22   from blog, blog_s using(id) group by id
    1.23  ), acclog_user as (
    1.24 -  select * from acclog where user='$user'
    1.25 +  select * from acclog where user='$user' and tbl='blog'
    1.26  ), blogall as (
    1.27   select b.id, b.rowid, b.owner, b.title, ctime, ac.author
    1.28   from blog_title_owner b, article_ctime ac
    1.29 @@ -1368,7 +1369,7 @@
    1.30   count(id) "総数", ctime, title,
    1.31   owner gecos -- (select gecos from gecoses where name=bl.owner) gecos
    1.32   from blogall bl left join acclog_user l
    1.33 -      on bl.rowid=l.tblrowid
    1.34 +      on bl.rowid=round(l.tblrowid)
    1.35   where case when (select name from user where owner=name) is not null
    1.36              then 1 /* user's diary is always readable */
    1.37              when (select val from grp_s
    1.38 @@ -1379,6 +1380,7 @@
    1.39              then 0
    1.40              else 1
    1.41         end
    1.42 + and l.user='$user'
    1.43   group by bl.id
    1.44   having "新着" > 0 order by "新着" desc, bl.id
    1.45   limit 10;