from base import *\r
-from forum import const\r
from django.contrib.contenttypes.models import ContentType\r
from django.contrib.auth.models import User as DjangoUser, AnonymousUser as DjangoAnonymousUser\r
from django.db.models import Q\r
\r
def get_reputation_by_upvoted_today(self):\r
today = datetime.datetime.now()\r
- sum = self.reputes.filter(\r
- models.Q(reputation_type=TYPE_REPUTATION_GAIN_BY_UPVOTED) |\r
- models.Q(reputation_type=TYPE_REPUTATION_LOST_BY_UPVOTE_CANCELED),\r
- reputed_at__range=(today - datetime.timedelta(days=1), today)).aggregate(models.Sum('value'))\r
-\r
- if sum.get('value__sum', None) is not None: return sum['value__sum']\r
+ sum = self.reputes.filter(reputed_at__range=(today - datetime.timedelta(days=1), today)).aggregate(models.Sum('value'))\r
+ #todo: redo this, maybe transform in the daily cap\r
+ #if sum.get('value__sum', None) is not None: return sum['value__sum']\r
return 0\r
\r
def get_flagged_items_count_today(self):\r
enable_notifications = models.BooleanField(default=True)\r
\r
#notify if\r
- member_joins = models.CharField(max_length=1, default='n', choices=const.NOTIFICATION_CHOICES)\r
- new_question = models.CharField(max_length=1, default='d', choices=const.NOTIFICATION_CHOICES)\r
- new_question_watched_tags = models.CharField(max_length=1, default='i', choices=const.NOTIFICATION_CHOICES)\r
- subscribed_questions = models.CharField(max_length=1, default='i', choices=const.NOTIFICATION_CHOICES)\r
+ member_joins = models.CharField(max_length=1, default='n')\r
+ new_question = models.CharField(max_length=1, default='d')\r
+ new_question_watched_tags = models.CharField(max_length=1, default='i')\r
+ subscribed_questions = models.CharField(max_length=1, default='i')\r
\r
#auto_subscribe_to\r
all_questions = models.BooleanField(default=False)\r