Added lastOnline field to Person table in createdb.

This commit is contained in:
Dominik Picheta 2013-01-13 22:52:53 +00:00
commit 0936542368
4 changed files with 18 additions and 12 deletions

View file

@ -1,9 +1,9 @@
#
#
# The Nimrod Forum
# (c) Copyright 2012 Andreas Rumpf
#
# All rights reserved.
# (c) Copyright 2012 Andreas Rumpf, Dominik Picheta
# Look at license.txt for more info.
# All rights reserved.
#
import cairo, os, strutils, jester

View file

@ -1,9 +1,9 @@
#
#
# Nimrod Forum
# (c) Copyright 2012 Andreas Rumpf
#
# All rights reserved.
# The Nimrod Forum
# (c) Copyright 2012 Andreas Rumpf, Dominik Picheta
# Look at license.txt for more info.
# All rights reserved.
#
import strutils, db_sqlite
@ -37,7 +37,8 @@ create table if not exists person(
creation timestamp not null default (DATETIME('now')),
salt varbin(128) not null,
status integer not null,
admin bool default false
admin bool default false,
lastOnline timestamp not null default (DATETIME('now'))
);""" % [TUserName, TPassword, TEmail]), [])
# echo "person table already exists"

View file

@ -220,7 +220,11 @@
#end for
</span>
<hr/>
<span>Total threads: ${stats.totalThreads} | Total posts: ${stats.totalPosts} | Newest member: ${stats.newestMember.nick}</span>
#if stats.newestMember.nick != "":
<span>Total threads: ${stats.totalThreads} | Total posts: ${stats.totalPosts} | Newest member: ${stats.newestMember.nick}</span>
#else:
<span>Total threads: ${stats.totalThreads} | Total posts: ${stats.totalPosts}</span>
#end if
</div>
</div>

View file

@ -1,9 +1,9 @@
#
#
# The Nimrod Forum
# (c) Copyright 2012 Andreas Rumpf
#
# All rights reserved.
# (c) Copyright 2012 Andreas Rumpf, Dominik Picheta
# Look at license.txt for more info.
# All rights reserved.
#
import
@ -451,6 +451,7 @@ proc getStats(c: var TForumData, simple: bool): TForumStats =
if not simple:
var newestMemberCreation = 0
result.activeUsers = @[]
result.newestMember = ("", -1, false)
const getUsersQuery =
sql"select id, name, admin, strftime('%s', lastOnline), strftime('%s', creation) from person"
for row in fastRows(db, getUsersQuery):