Adding premiums to munin. Fixing a few missing feeds bugs. These have to be addressed categorically, but for now, just pass on the bad ones.

This commit is contained in:
Samuel Clay 2010-10-29 09:02:54 -04:00
parent 56cff2fe96
commit 22570cf4c8
4 changed files with 10 additions and 7 deletions

View file

@ -5,6 +5,7 @@ from django.contrib.auth.models import User
from django.db.models.signals import post_save from django.db.models.signals import post_save
from django.core.mail import mail_admins from django.core.mail import mail_admins
from apps.reader.models import UserSubscription from apps.reader.models import UserSubscription
from apps.rss_feeds.models import Feed
from paypal.standard.ipn.signals import subscription_signup from paypal.standard.ipn.signals import subscription_signup
from utils import log as logging from utils import log as logging
@ -30,7 +31,7 @@ class Profile(models.Model):
try: try:
sub.save() sub.save()
sub.feed.setup_feed_for_premium_subscribers() sub.feed.setup_feed_for_premium_subscribers()
except IntegrityError: except IntegrityError, Feed.DoesNotExist:
pass pass
logging.info(' ---> [%s] NEW PREMIUM ACCOUNT! WOOHOO!!! %s subscriptions!' % (self.user.username, subs.count())) logging.info(' ---> [%s] NEW PREMIUM ACCOUNT! WOOHOO!!! %s subscriptions!' % (self.user.username, subs.count()))

View file

@ -622,7 +622,7 @@ def save_feed_chooser(request):
activated = 0 activated = 0
usersubs = UserSubscription.objects.filter(user=request.user) usersubs = UserSubscription.objects.filter(user=request.user)
for sub in usersubs: for sub in usersubs:
if sub.feed.pk in approved_feeds: if sub.feed and sub.feed.pk in approved_feeds:
sub.active = True sub.active = True
activated += 1 activated += 1
sub.save() sub.save()

View file

@ -2360,11 +2360,11 @@
$.make('div', { className: 'NB-menu-manage-title' }, 'Intelligence Trainer'), $.make('div', { className: 'NB-menu-manage-title' }, 'Intelligence Trainer'),
$.make('div', { className: 'NB-menu-manage-subtitle' }, 'Accurate filters are happy filters.') $.make('div', { className: 'NB-menu-manage-subtitle' }, 'Accurate filters are happy filters.')
]), ]),
$.make('li', { className: 'NB-menu-manage-preferences' }, [ // $.make('li', { className: 'NB-menu-manage-preferences' }, [
$.make('div', { className: 'NB-menu-manage-image' }), // $.make('div', { className: 'NB-menu-manage-image' }),
$.make('div', { className: 'NB-menu-manage-title' }, 'Preferences'), // $.make('div', { className: 'NB-menu-manage-title' }, 'Preferences'),
$.make('div', { className: 'NB-menu-manage-subtitle' }, 'Defaults and options.') // $.make('div', { className: 'NB-menu-manage-subtitle' }, 'Defaults and options.')
]), // ]),
(show_chooser && $.make('li', { className: 'NB-menu-manage-feedchooser' }, [ (show_chooser && $.make('li', { className: 'NB-menu-manage-feedchooser' }, [
$.make('div', { className: 'NB-menu-manage-image' }), $.make('div', { className: 'NB-menu-manage-image' }),
$.make('div', { className: 'NB-menu-manage-title' }, 'Choose Your 64'), $.make('div', { className: 'NB-menu-manage-title' }, 'Choose Your 64'),

View file

@ -12,6 +12,7 @@ graph_config = {
'all.label': 'all', 'all.label': 'all',
'monthly.label': 'monthly', 'monthly.label': 'monthly',
'daily.label': 'daily', 'daily.label': 'daily',
'premium.label': 'premium',
} }
last_month = datetime.datetime.utcnow() - datetime.timedelta(days=30) last_month = datetime.datetime.utcnow() - datetime.timedelta(days=30)
@ -21,6 +22,7 @@ metrics = {
'all': User.objects.count(), 'all': User.objects.count(),
'monthly': Profile.objects.filter(last_seen_on__gte=last_month).count(), 'monthly': Profile.objects.filter(last_seen_on__gte=last_month).count(),
'daily': Profile.objects.filter(last_seen_on__gte=last_day).count(), 'daily': Profile.objects.filter(last_seen_on__gte=last_day).count(),
'premium': Profile.objects.filter(is_premium=True).count(),
} }
if __name__ == '__main__': if __name__ == '__main__':