Example #1
0
    def get(self):
        # get the stats based on the past 7 days
        today = datetime.today()
        week_ago = today + timedelta(days=-7)

        single_post_count = 0
        unique_posters = postsdb.get_unique_posters(week_ago, today)
        for user in unique_posters:
            if user['count'] == 1:
                single_post_count += 1

        stats = []
        stats.append({
            'name': 'total',
            'link': '',
            'count': postsdb.get_post_count_for_range(week_ago, today)
        })
        stats.append({
            'name': 'unique posters',
            'link': '',
            'count': len(unique_posters)
        })
        stats.append({
            'name': 'single post count',
            'link': '',
            'count': single_post_count
        })

        self.render('stats/share_stats.html', stats=stats)
Example #2
0
    def get(self):
        # get the stats based on the past 7 days
        today = datetime.today()
        week_ago = today + timedelta(days=-7)

        single_post_count = 0
        unique_posters = postsdb.get_unique_posters(week_ago, today)
        for user in unique_posters:
            if user['count'] == 1:
                single_post_count += 1

        stats = []
        stats.append({'name':'total','link':'','count':postsdb.get_post_count_for_range(week_ago, today)})
        stats.append({'name':'unique posters', 'link':'','count':len(unique_posters)})
        stats.append({'name':'single post count', 'link':'','count':single_post_count})

        self.render('stats/share_stats.html', stats=stats)
Example #3
0
from datetime import datetime, timedelta
import optparse
from lib import statsdb, postsdb

parser = optparse.OptionParser()
parser.add_option('-s',
                  '--start',
                  action="store",
                  dest="start_date",
                  help="start date",
                  default="today")
options, args = parser.parse_args()

if options.start_date == "today":
    options.start_date = datetime.today()

start_date_str = options.start_date
start_date = datetime.strptime(start_date_str, "%m-%d-%Y")
end_date = start_date + timedelta(days=7)
count = postsdb.get_post_count_for_range(start_date, end_date)
unique_posters = postsdb.get_unique_posters(start_date, end_date)
single_post_count = 0
for user in unique_posters:
    if user['count'] == 1:
        single_post_count += 1

print "Week starting %s" % start_date_str
print "+++ %s posts" % count
print "+++ %s unique posters" % len(unique_posters)
print "+++ %s one-time posters" % single_post_count
Example #4
0
import settings
import logging
from datetime import datetime, timedelta
import optparse
from lib import statsdb, postsdb

parser = optparse.OptionParser()
parser.add_option('-s', '--start',
	action="store", dest="start_date",
	help="start date", default="today")
options, args = parser.parse_args()

if options.start_date == "today":
	options.start_date = datetime.today()

start_date_str = options.start_date
start_date = datetime.strptime(start_date_str, "%m-%d-%Y")
end_date = start_date + timedelta(days=7)
count = postsdb.get_post_count_for_range(start_date, end_date)
unique_posters = postsdb.get_unique_posters(start_date, end_date)
single_post_count = 0
for user in unique_posters:
	if user['count'] == 1:
		single_post_count += 1


print "Week starting %s" % start_date_str
print "+++ %s posts" % count 
print "+++ %s unique posters" % len(unique_posters)
print "+++ %s one-time posters" % single_post_count