[CalendarServer-changes] [8492] CalendarServer/trunk/calendarserver/tools/dbinspect.py
source_changes at macosforge.org
source_changes at macosforge.org
Sat Jan 7 06:12:36 PST 2012
Revision: 8492
http://trac.macosforge.org/projects/calendarserver/changeset/8492
Author: cdaboo at apple.com
Date: 2012-01-07 06:12:35 -0800 (Sat, 07 Jan 2012)
Log Message:
-----------
Show total and average for home summary.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/dbinspect.py
Modified: CalendarServer/trunk/calendarserver/tools/dbinspect.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/dbinspect.py 2012-01-07 04:06:55 UTC (rev 8491)
+++ CalendarServer/trunk/calendarserver/tools/dbinspect.py 2012-01-07 14:12:35 UTC (rev 8492)
@@ -157,6 +157,7 @@
# Print table of results
table = tables.Table()
table.addHeader(("Owner UID", "Short Name", "Calendars", "Resources"))
+ totals = [0, 0, 0]
for uid in sorted(results.keys()):
shortname = UserNameFromUID(txn, uid)
table.addRow((
@@ -165,6 +166,16 @@
results[uid][0],
results[uid][1],
))
+ totals[0] += 1
+ totals[1] += results[uid][0]
+ totals[2] += results[uid][1]
+ table.addFooter(("Total", totals[0], totals[1], totals[2]))
+ table.addFooter((
+ "Average",
+ "",
+ "%.2f" % ((1.0 * totals[1])/totals[0] if totals[0] else 0,),
+ "%.2f" % ((1.0 * totals[2])/totals[0] if totals[0] else 0,),
+ ))
print "\n"
print "Calendars with resource count (total=%d):\n" % (len(results),)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120107/54fd6177/attachment-0001.html>
More information about the calendarserver-changes
mailing list