예제 #1
0
    def membership_status(user):
        """ Return membership status, irrespective of waiver status.

        (Companies don't care about participant waiver status, so ignore it).
        """
        # Status is one external query per user. Expensive! (We should refactor...)
        membership = geardb.user_membership_expiration(user)['membership']

        # We report Active/Expired, since companies don't care about waiver status
        if membership['active']:
            return 'Active'
        if membership['expires']:
            return 'Expired {}'.format(membership['expires'].isoformat())
        return 'Missing'
예제 #2
0
    def membership_status(user):
        """ Return membership status, irrespective of waiver status.

        (Companies don't care about participant waiver status, so ignore it).
        """
        # Status is one external query per user. Expensive! (We should refactor...)
        membership = geardb.user_membership_expiration(user)['membership']

        # We report Active/Expired, since companies don't care about waiver status
        if membership['active']:
            return 'Active'
        if membership['expires']:
            return 'Expired {}'.format(membership['expires'].isoformat())
        return 'Missing'
예제 #3
0
 def get(self, request, *args, **kwargs):
     user = self.get_object()
     try_cache = bool(request.GET.get('try_cache'))
     membership = geardb_utils.user_membership_expiration(user, try_cache)
     return JsonResponse(membership)
예제 #4
0
 def test_expiration_no_emails(self):
     """ Test users with no email addresses. """
     self.assertIsNone(geardb.user_membership_expiration(None))
     self.assertIsNone(geardb.user_membership_expiration(AnonymousUser()))
예제 #5
0
 def get(self, request, *args, **kwargs):
     user = self.get_object()
     return JsonResponse(geardb_utils.user_membership_expiration(user))
예제 #6
0
 def test_expiration_no_emails(self):
     """ Test users with no email addresses. """
     self.assertIsNone(geardb.user_membership_expiration(None))
     self.assertIsNone(geardb.user_membership_expiration(AnonymousUser()))