diff --git a/Src/network-broker/stats.py b/Src/network-broker/stats.py index 45d66af..6d82623 100644 --- a/Src/network-broker/stats.py +++ b/Src/network-broker/stats.py @@ -3,6 +3,7 @@ from operator import itemgetter class Container: def __init__(self): + self.total_connections = 0 self.country_count = {} self.last_10 = [] @@ -16,6 +17,7 @@ class Container: def add_connection(self, who, country): s = "%s (%s)" % (who, country) + self.total_connections = self.total_connections + 1 self.last_10 = [s] + self.last_10[:9] self.add_country(country) @@ -28,6 +30,8 @@ class HtmlGenerator: reverse=True, key=itemgetter(1)) outf.write("\n") + outf.write("

Frodo-Wii network statistics

\n") + outf.write("The total number of connections is %d
\n" % (self.container.total_connections)) outf.write("

Last %d connections

\n" % (len(self.container.last_10)) ) for item in self.container.last_10: outf.write("%s
\n" % (item) )