]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/models/user.py
Remove old method. Proably causing model validation errors?
[osqa.git] / forum / models / user.py
index ff7bef1d2f011ede2e96f9b233598904e2b3f529..3e92e1670c6d2fa548dfc4df184a2825fbce746b 100644 (file)
@@ -1,5 +1,4 @@
 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
@@ -151,12 +150,9 @@ class User(BaseModel, DjangoUser):
 \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
@@ -248,10 +244,10 @@ class SubscriptionSettings(models.Model):
     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