jlelse
/
kis3
Archived
1
Fork 0

Add view "useragentnames"

This commit is contained in:
Jan-Lukas Else 2019-04-09 14:31:15 +02:00
parent c9df3dfe9d
commit 373b742f17
2 changed files with 6 additions and 0 deletions

View File

@ -69,6 +69,7 @@ const (
PAGES View = iota + 1
REFERRERS
USERAGENTS
USERAGENTNAMES
HOURS
DAYS
WEEKS
@ -136,6 +137,9 @@ func (request *ViewsRequest) buildStatement(filters string) (statement string) {
case USERAGENTS:
statement = "SELECT useragent as first, count(*) as second from views" + filters + "group by useragent;"
return
case USERAGENTNAMES:
statement = "SELECT substr(useragent, 1, pos-1) as first, COUNT(*) from (SELECT *, instr(useragent,' ') AS pos FROM views)" + filters + "group by first;"
return
case HOURS, DAYS, WEEKS, MONTHS:
format := ""
switch request.view {

View File

@ -113,6 +113,8 @@ func requestStats(w http.ResponseWriter, r *http.Request) {
view = REFERRERS
case "useragents":
view = USERAGENTS
case "useragentnames":
view = USERAGENTNAMES
case "hours":
view = HOURS
case "days":