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 # The Nimrod Forum
# (c) Copyright 2012 Andreas Rumpf # (c) Copyright 2012 Andreas Rumpf, Dominik Picheta
# # Look at license.txt for more info.
# All rights reserved. # All rights reserved.
# #
import cairo, os, strutils, jester import cairo, os, strutils, jester

View file

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

View file

@ -220,7 +220,11 @@
#end for #end for
</span> </span>
<hr/> <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>
</div> </div>

View file

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