Beispiel #1
0
    def get_object_list(self, request):
        results = {}
        current_user = request.user
        user_id = request.GET.get('user_id')
        if user_id is None:
            logger.error('user_id is required')
            raise BadRequest('user_id is required')
        try:
            user = FacebookCustomUserActive.objects.get(pk=user_id)
        except FacebookCustomUserActive.DoesNotExist as err:
            logging.exception(err)
            raise BadRequest('incorrect user_id')
        mutual_friends_ids = NeoFourJ().get_mutual_friends(current_user.id,
                                                           user.id)
        friends_ids = NeoFourJ().get_my_friends_ids(user.id)

        # Remove current user from list ICE-2194
        if current_user.id in friends_ids:
            friends_ids.remove(current_user.id)

        other_ids = list(set(friends_ids) - set(mutual_friends_ids))

        mutual_friends = MatchQuerySet.filter(current_user, mutual_friends_ids)
        for obj in mutual_friends:
            obj.mutual = True
            obj.user_type = "persice"
            results[obj.user_id] = obj
            results[obj.facebook_id] = FacebookMutualUser(
                id=obj.facebook_id,
                user_id=obj.user_id,
                distance=getattr(obj, 'distance', []),
                first_name=obj.first_name,
                last_name=obj.last_name,
                facebook_id=obj.facebook_id,
                mutual=True,
                user_type='facebook'
            )

        other = MatchQuerySet.filter(current_user, other_ids)
        for obj1 in other:
            obj1.mutual = False
            obj1.user_type = "persice"
            results[obj1.user_id] = obj1

        twitters = mutual_twitter_friends(current_user, user_id)

        for twitter in twitters:
            results[twitter.twitter_id2] = TwitterMutualUser(
                id=twitter.twitter_id2,
                user_id=twitter.twitter_id2,
                distance=[],
                twitter_id=twitter.twitter_id2,
                first_name=twitter.name2,
                image=twitter.profile_image_url2,
                username=twitter.screen_name2,
                mutual=True,
                user_type='twitter'
            )

        return sorted(results.values(), key=lambda x: -x.mutual)
Beispiel #2
0
    def test_filter_with_different_word_form_of_keywords2(self):
        """
        Searching Crowd for "hiking" yields no results
        (but search for "hike" does) - ICE-1311
        """
        Goal.objects.create(user=self.user, goal=self.subject)
        Goal.objects.create(user=self.user1, goal=self.subject)
        Goal.objects.create(user=self.user1,
                            goal=Subject.objects.create(description='hike'))

        Goal.objects.create(user=self.user2, goal=self.subject)

        FilterState.objects.create(user=self.user,
                                   min_age=18,
                                   max_age=99,
                                   keyword='hiking',
                                   distance=16516)
        update_index.Command().handle(interactive=False)
        match_users = MatchQuerySet.all(self.user.id, is_filter=True)
        self.assertEqual(len(match_users), 1)
        self.assertEqual(match_users[0].first_name, 'Sasa')
        self.assertEqual(match_users[0].goals, [{
            u'learning django': 1,
            u'hike': 0
        }])
Beispiel #3
0
 def test_order_mutual_friends(self):
     Goal.objects.get_or_create(user=self.user, goal=self.subject)
     Goal.objects.get_or_create(user=self.user1, goal=self.subject5)
     Goal.objects.get_or_create(user=self.user2, goal=self.subject5)
     Goal.objects.get_or_create(user=self.user3, goal=self.subject5)
     Goal.objects.get_or_create(user=self.user4, goal=self.subject5)
     Goal.objects.get_or_create(user=self.user5, goal=self.subject5)
     FilterState.objects.create(user=self.user,
                                min_age=18,
                                max_age=99,
                                distance=16000,
                                order_criteria='mutual_friends')
     self.neo.create_friendship(self.user, self.user1)
     self.neo.create_friendship(self.user, self.user3)
     self.neo.create_friendship(self.user5, self.user1)
     self.neo.create_friendship(self.user5, self.user3)
     self.neo.create_friendship(self.user4, self.user1)
     update_index.Command().handle(interactive=False)
     match_users = MatchQuerySet.all(self.user.id, is_filter=True)
     self.assertEqual(len(match_users), 3)
     resp = self.api_client.get('/api/v1/matchfeed/',
                                authentication=self.get_credentials(),
                                format='json')
     self.assertValidJSONResponse(resp)
     data = self.deserialize(resp)['objects']
     self.assertEqual(data[0]['friends_score'], 2)
     self.assertEqual(data[1]['friends_score'], 1)
     self.assertEqual(data[2]['friends_score'], 0)
Beispiel #4
0
    def test_filter_by_keywords_my_events(self):
        e = Event.objects.create(starts_on='2055-06-13T05:15:22.792659',
                                 ends_on='2055-06-14T05:15:22.792659',
                                 name="Play piano",
                                 location=[7000, 22965.83])

        e1 = Event.objects.create(starts_on='2055-06-13T05:15:22.792659',
                                  ends_on='2055-06-14T05:15:22.792659',
                                  name="python meetup",
                                  location=[700, 22965.83])

        Membership.objects.create(user=self.user,
                                  event=e,
                                  is_organizer=True,
                                  rsvp='yes')
        Membership.objects.create(user=self.user,
                                  event=e1,
                                  is_organizer=True,
                                  rsvp='yes')
        assign_perm('view_event', self.user, e)
        assign_perm('view_event', self.user, e1)
        FilterState.objects.create(user=self.user,
                                   min_age=18,
                                   max_age=99,
                                   keyword='python',
                                   distance=16516)
        update_index.Command().handle(interactive=False)
        events = MatchQuerySet.all_event(self.user.id,
                                         feed='my',
                                         is_filter=True)
        self.assertEqual(len(events), 1)
        self.assertEqual(events[0].name, 'python meetup')
Beispiel #5
0
 def obj_get(self, bundle, **kwargs):
     event_id = int(kwargs.get('pk'))
     try:
         event = Event.objects.get(pk=event_id)
     except Event.DoesNotExist:
         raise NotFound("Organizer not found")
     if event.organizer:
         event_organizer = event.organizer
         match_user = MatchQuerySet.between(
             user_id1=bundle.request.user.id, user_id2=event_organizer.id
         )
         if match_user:
             match_user = match_user[0]
             match_user.id = event_id
         else:
             match_user = NonMatchUser(
                 bundle.request.user.id, event_organizer.id
             )
         match_user.event_type = event.event_type
     else:
         fb_event = FacebookEvent.objects.filter(
             facebook_id=event.eid).first()
         obj = A()
         obj.id = event.id
         obj.first_name = fb_event.owner_info.get('name')
         obj.link = 'https://www.facebook.com/{}/'.format(
             fb_event.owner_info.get('id')
         )
         obj.event_type = event.event_type
         return obj
     return match_user
Beispiel #6
0
 def test_simple_match_query_set(self):
     Goal.objects.create(user=self.user, goal=self.subject)
     Offer.objects.create(user=self.user1, offer=self.subject5)
     update_index.Command().handle(interactive=False)
     users = MatchQuerySet.all(self.user.id)
     self.assertEqual(len(users), 1)
     self.assertEqual(users[0].first_name, 'Sasa')
Beispiel #7
0
 def get_object_list(self, request):
     fs = FilterState.objects.filter(user=request.user.id)
     cache_match_users = None
     filter_updated_sha = None
     if fs:
         try:
             attrs = [fs[0].gender, fs[0].min_age, fs[0].max_age,
                      fs[0].distance, fs[0].distance_unit,
                      fs[0].order_criteria, fs[0].keyword]
             filter_updated = '.'.join(map(str, attrs))
             filter_updated_sha = hashlib.sha1(filter_updated).hexdigest()
             # Concatenate all filters value instead!!!
             # m.1312.10000mi.sim
             # filter_updated = time.mktime(fs[0].updated.timetuple())
             cache_match_users = cache.get('%s_%s' % (request.user.id,
                                                      filter_updated_sha))
         except AttributeError:
             pass
     if cache_match_users:
         match_users = cache_match_users
     else:
         match_users = MatchQuerySet.all(request.user.id, is_filter=True)
         cache.set('%s_%s' % (request.user.id,
                              filter_updated_sha), match_users)
     if fs:
         if fs[0].order_criteria == 'match_score':
             return sorted(match_users, key=lambda x: -x.score)
         elif fs[0].order_criteria == 'mutual_friends':
             return sorted(match_users, key=lambda x: -x.friends_score)
         elif fs[0].order_criteria == 'date':
             return sorted(match_users, key=lambda x: x.last_login,
                           reverse=True)
     return match_users
Beispiel #8
0
 def get_object_list(self, request):
     username = request.GET.get('username')
     user = FacebookCustomUserActive.objects.filter(username=username)
     match_users = []
     if user:
         match_users = MatchQuerySet.between(request.user.id, user[0].id)
     return match_users
Beispiel #9
0
    def dehydrate(self, bundle):
        user_id = bundle.request.user.id
        friends = NeoFourJ().get_my_friends_ids(user_id)
        try:
            bundle.data['hosted_by'] = bundle.obj.membership_set. \
                filter(is_organizer=True, rsvp='yes')[0].user.get_full_name()
        except IndexError:
            bundle.data['hosted_by'] = ''

        # Total number of event attendees
        total_attendees = bundle.obj. \
            membership_set.filter(rsvp='yes').count()
        bundle.data['total_attendees'] = total_attendees

        # the number of people with RSVP = yes AND
        # are also a connection of the user who is viewing the event
        attendees = bundle.obj. \
            membership_set.filter(user__in=friends + [user_id], rsvp='yes')
        bundle.data['friend_attendees_count'] = attendees.count()

        # spots_remaining = max_attendees - total_attendees
        # TODO: max_attendees in ICE-938
        bundle.data['spots_remaining'] = int(
            bundle.obj.max_attendees) - total_attendees

        matched_users = MatchQuerySet.attendees(user_id)
        bundle.data['attendees_yes'] = MatchEvent.get_attendees(
            user_id, bundle.obj, matched_users, rsvp='yes')
        bundle.data['attendees_no'] = MatchEvent.get_attendees(
            user_id, bundle.obj, matched_users, rsvp='no')
        bundle.data['attendees_maybe'] = MatchEvent.get_attendees(
            user_id, bundle.obj, matched_users, rsvp='maybe')

        bundle.data['cumulative_match_score'] = MatchEvent.get_cum_score(
            user_id, bundle.obj, matched_users)

        try:
            bundle.data['distance'] = MatchQuerySet.user_event(
                    bundle.request.user.id,
                    bundle.obj.pk
            )[0].distance
        except IndexError:
            bundle.data['distance'] = [10000, 'mi']
        bundle.data['organizer'] = build_organizer(bundle.obj)
        return bundle
Beispiel #10
0
 def test_simple_match_between(self):
     Goal.objects.create(user=self.user, goal=self.subject11)
     Goal.objects.create(user=self.user1, goal=self.subject10)
     Goal.objects.create(user=self.user2, goal=self.subject10)
     Goal.objects.create(user=self.user3, goal=self.subject10)
     update_index.Command().handle(interactive=False)
     users = MatchQuerySet.between(self.user.id, self.user1.id)
     self.assertEqual(len(users), 1)
     self.assertEqual(users[0].score, 1)
Beispiel #11
0
 def test_simple_match_score_offers(self):
     Offer.objects.create(user=self.user, offer=self.subject)
     Offer.objects.create(user=self.user, offer=self.subject2)
     Offer.objects.create(user=self.user1, offer=self.subject5)
     Offer.objects.create(user=self.user1, offer=self.subject6)
     Offer.objects.create(user=self.user1, offer=self.subject7)
     update_index.Command().handle(interactive=False)
     users = MatchQuerySet.all(self.user.id)
     self.assertEqual(users[0].score, 2)
Beispiel #12
0
 def test_filter_gender_female(self):
     Goal.objects.create(user=self.user, goal=self.subject)
     Goal.objects.create(user=self.user4, goal=self.subject5)
     FilterState.objects.create(user=self.user, gender='f', max_age=99)
     update_index.Command().handle(interactive=False)
     match_users = MatchQuerySet.all(self.user.id, is_filter=True)
     self.assertEqual(len(match_users), 1)
     self.assertEqual(match_users[0].first_name, 'Tati')
     self.assertEqual(match_users[0].gender, 'f')
Beispiel #13
0
 def test_simple_top_interests_less_than_3(self):
     Goal.objects.create(user=self.user, goal=self.subject11)
     Goal.objects.create(user=self.user1, goal=self.subject10)
     update_index.Command().handle(interactive=False)
     match_users = MatchQuerySet.all(self.user.id)
     self.assertEqual(len(match_users), 1)
     self.assertEqual(match_users[0].top_interests[0], {
         u'kiteboarding': 1,
         u'foxes': 0
     })
Beispiel #14
0
 def test_filter_gender_male(self):
     Goal.objects.create(user=self.user, goal=self.subject)
     Goal.objects.create(user=self.user1, goal=self.subject5)
     Goal.objects.create(user=self.user3, goal=self.subject5)
     FilterState.objects.create(user=self.user, gender='m', distance=16516)
     update_index.Command().handle(interactive=False)
     match_users = MatchQuerySet.all(self.user.id, is_filter=True)
     self.assertEqual(len(match_users), 1)
     self.assertEqual(match_users[0].first_name, 'Sasa')
     self.assertEqual(match_users[0].gender, 'm')
Beispiel #15
0
 def test_simple_top_interests(self):
     Goal.objects.create(user=self.user, goal=self.subject)
     Goal.objects.create(user=self.user1, goal=self.subject15)
     update_index.Command().handle(interactive=False)
     match_users = MatchQuerySet.all(self.user.id)
     self.assertEqual(len(match_users), 1)
     self.assertEqual(match_users[0].top_interests[0], {
         u'coding': 0,
         u'django': 1,
         u'python': 0
     })
Beispiel #16
0
    def get_object_list(self, request):
        now = time.time()
        rsvp = request.GET.get('rsvp')
        event_id = request.GET.get('event_id')
        try:
            interest_id = int(request.GET.get('interest_id'))
        except (ValueError, TypeError):
            try:
                interest_id = int(request.GET.get('interest'))
            except (ValueError, TypeError):
                interest_id = None
        if rsvp is None and event_id is None:
            logger.error('rsvp and event_id is required')
            raise BadRequest('rsvp and event_id is required')
        if rsvp not in ('yes', 'no', 'maybe'):
            logger.error('rsvp is incorrect rsvp: {}'.format(rsvp))
            raise BadRequest('Please use correct rsvp: yes, no or maybe')
        if interest_id:
            user_ids = Interest.objects.filter(
                interest_id=interest_id
            ).values_list('user_id', flat=True)
            attendees_ids = Membership.objects.filter(
                rsvp=rsvp, event_id=event_id, is_organizer=False,
                user_id__in=user_ids
            ).values_list('user_id', flat=True)
        else:
            attendees_ids = Membership.objects.filter(
                rsvp=rsvp, event_id=event_id, is_organizer=False
            ).values_list('user_id', flat=True)

        if rsvp == 'yes':
            attendees_ids = list(attendees_ids)

        match_users = MatchQuerySet.all(request.user.id,
                                        is_filter=False, exclude_ids=())
        attendees = []
        matched_attendees_ids = []
        for match_user in match_users:
            if match_user.id in attendees_ids:
                attendees.append(match_user)
                matched_attendees_ids.append(match_user.id)
        non_match_attendees = set(attendees_ids) - set(matched_attendees_ids)
        for non_match_attendee in non_match_attendees:
            try:
                non_match_user = NonMatchUser(request.user.id,
                                              non_match_attendee)
                attendees.append(non_match_user)
            except FacebookCustomUserActive.DoesNotExist as er:
                logger.error(er)

        logger.info('/api/v2/attendees/: {}'.format(time.time() - now))
        return sorted(attendees, key=lambda x: (-x.score,
                                                -x.connected))
Beispiel #17
0
 def test_filter_distance(self):
     Goal.objects.create(user=self.user, goal=self.subject)
     Goal.objects.create(user=self.user1, goal=self.subject5)
     Goal.objects.create(user=self.user1, goal=self.subject2)
     Goal.objects.create(user=self.user3, goal=self.subject5)
     FilterState.objects.create(user=self.user,
                                min_age=18,
                                max_age=99,
                                distance=1)
     update_index.Command().handle(interactive=False)
     match_users = MatchQuerySet.all(self.user.id, is_filter=True)
     self.assertEqual(len(match_users), 0)
Beispiel #18
0
 def test_exclude_friends(self):
     Goal.objects.create(user=self.user, goal=self.subject)
     Goal.objects.create(user=self.user1, goal=self.subject5)
     Goal.objects.create(user=self.user3, goal=self.subject5)
     FilterState.objects.create(user=self.user,
                                min_age=18,
                                max_age=99,
                                distance=10000)
     self.neo.create_friendship(self.user, self.user3)
     update_index.Command().handle(interactive=False)
     match_users = MatchQuerySet.all(self.user.id)
     self.assertEqual(len(match_users), 1)
     self.assertEqual(match_users[0].first_name, 'Sasa')
Beispiel #19
0
 def test_top_interests(self):
     Goal.objects.create(user=self.user, goal=self.subject12)
     Goal.objects.create(user=self.user, goal=self.subject)
     Goal.objects.create(user=self.user, goal=self.subject2)
     Offer.objects.create(user=self.user, offer=self.subject3)
     Goal.objects.create(user=self.user1, goal=self.subject13)
     Goal.objects.create(user=self.user1, goal=self.subject5)
     Goal.objects.create(user=self.user1, goal=self.subject6)
     Offer.objects.create(user=self.user1, offer=self.subject7)
     update_index.Command().handle(interactive=False)
     match_users = MatchQuerySet.all(self.user.id)
     self.assertEqual(len(match_users), 1)
     self.assertEqual(match_users[0].top_interests, [{
         u'child': 0,
         u'django': 1,
         u'erlang': 1,
         u'python': 1
     }])
Beispiel #20
0
 def test_filter_two_keywords(self):
     Goal.objects.create(user=self.user, goal=self.subject)
     Goal.objects.create(user=self.user1, goal=self.subject5)
     Goal.objects.create(user=self.user1, goal=self.subject2)
     Goal.objects.create(user=self.user3, goal=self.subject5)
     FilterState.objects.create(user=self.user,
                                min_age=18,
                                max_age=99,
                                keyword='python,ruby',
                                distance=16516)
     update_index.Command().handle(interactive=False)
     match_users = MatchQuerySet.all(self.user.id, is_filter=True)
     self.assertEqual(len(match_users), 1)
     self.assertEqual(match_users[0].first_name, 'Sasa')
     self.assertEqual(match_users[0].goals, [{
         u'learn python': 0,
         u'teach django': 1
     }])
Beispiel #21
0
    def get_object_list(self, request):
        match = []
        if request.GET.get('filter') == 'true':
            if request.GET.get('feed') == 'my':
                feed = 'my'
            elif request.GET.get('feed') == 'all':
                feed = 'all'
            elif request.GET.get('feed') == 'connections':
                feed = 'connections'
            else:
                feed = 'all'
            fs = FilterState.objects.filter(user=request.user.id)
            attrs = [fs[0].gender, fs[0].min_age, fs[0].max_age,
                     fs[0].distance, fs[0].distance_unit,
                     fs[0].order_criteria, fs[0].keyword]
            filter_updated = '.'.join(map(str, attrs))
            filter_updated_sha = hashlib.sha1(filter_updated).hexdigest()
            cache_key = 'e_%s_%s_%s' % (feed, request.user.id,
                                        filter_updated_sha)
            cached_match = cache.get(cache_key)
            if cached_match:
                match = cached_match
            else:
                match = MatchQuerySet. \
                    all_event(request.user.id, feed=feed,
                              is_filter=True)
                cache.set('e_%s_%s_%s' % (feed, request.user.id,
                                          filter_updated_sha), match, 180)
            if fs:
                if fs[0].order_criteria == 'match_score':
                    return sorted(
                        match, key=lambda x: -x.cumulative_match_score)
                elif fs[0].order_criteria == 'event_score':
                    return sorted(match,
                                  key=lambda x: -x.recommended_event_score)
                elif fs[0].order_criteria == 'mutual_friends':
                    return sorted(
                        match, key=lambda x: -x.friend_attendees_count)
                elif fs[0].order_criteria == 'date':
                    return sorted(match, key=lambda x: x.starts_on)
        else:
            match = MatchQuerySet.all_event(request.user.id, feed='my')

        return match
Beispiel #22
0
    def test_filter_by_recommended_event_score_my_events(self):
        e = Event.objects.create(starts_on='2055-06-13T05:15:22.792659',
                                 ends_on='2055-06-14T05:15:22.792659',
                                 description='PyCon is a conference for the '
                                 'Python community, organized by '
                                 'members of the Python community '
                                 'PyCon is for Python enthusiasts '
                                 'of all experience levels, from '
                                 'new users to core developers.',
                                 name="Python Con",
                                 location=[7000, 22965.83])

        e1 = Event.objects.create(starts_on='2055-06-13T05:15:22.792659',
                                  ends_on='2055-06-14T05:15:22.792659',
                                  name="python meetup",
                                  location=[700, 22965.83])

        Goal.objects.get_or_create(user=self.user, goal=self.subject)
        Goal.objects.get_or_create(user=self.user, goal=self.subject2)
        Membership.objects.create(user=self.user,
                                  event=e,
                                  is_organizer=True,
                                  rsvp='yes')
        Membership.objects.create(user=self.user,
                                  event=e1,
                                  is_organizer=True,
                                  rsvp='yes')
        assign_perm('view_event', self.user, e)
        assign_perm('view_event', self.user, e1)
        FilterState.objects.create(user=self.user,
                                   min_age=18,
                                   max_age=99,
                                   keyword='python',
                                   order_criteria='event_score',
                                   distance=16516)
        update_index.Command().handle(interactive=False)
        events = MatchQuerySet.all_event(self.user.id,
                                         feed='my',
                                         is_filter=True)
        self.assertEqual(len(events), 2)
        self.assertEqual(events[0].name, 'python meetup')
        self.assertEqual(events[0].recommended_event_score, 1)
        self.assertEqual(events[1].recommended_event_score, 4)
Beispiel #23
0
 def test_my_events(self):
     self.event = Event.objects. \
         create(starts_on='2055-06-13T05:15:22.792659',
                ends_on='2055-06-14T05:15:22.792659',
                name="Play piano", location=[7000, 22965.83])
     self.event1 = Event.objects. \
         create(starts_on='2055-06-13T05:15:22.792659',
                ends_on='2055-06-14T05:15:22.792659',
                name="python meetup", location=[7000, 22965.83])
     self.membership = Membership.objects. \
         create(user=self.user, event=self.event,
                is_organizer=True, rsvp='yes')
     self.membership = Membership.objects. \
         create(user=self.user1, event=self.event1,
                is_organizer=True, rsvp='yes')
     assign_perm('view_event', self.user, self.event)
     update_index.Command().handle(interactive=False)
     events = MatchQuerySet.all_event(self.user.id, feed='my')
     self.assertEqual(len(events), 1)
     self.assertEqual(events[0].name, 'Play piano')
Beispiel #24
0
def refresh_cache(user_id=None):
    fs = FilterState.objects.filter(user=user_id)
    cache_match_users = None
    filter_updated_sha = None
    if fs:
        try:
            attrs = [fs[0].gender, fs[0].min_age, fs[0].max_age,
                     fs[0].distance, fs[0].distance_unit,
                     fs[0].order_criteria, fs[0].keyword]
            filter_updated = '.'.join(map(str, attrs))
            filter_updated_sha = hashlib.sha1(filter_updated).hexdigest()
            # Concatenate all filters value instead!!!
            # m.1312.10000mi.sim
            # filter_updated = time.mktime(fs[0].updated.timetuple())
            cache_match_users = cache.get('%s_%s' % (user_id,
                                                     filter_updated_sha))
        except AttributeError:
            pass
    if cache_match_users:
        pass
    else:
        match_users = MatchQuerySet.all(user_id, is_filter=True)
        cache.set('%s_%s' % (user_id,
                             filter_updated_sha), match_users)
Beispiel #25
0
 def test_highlight_simple_match_offer_query_set(self):
     Offer.objects.create(user=self.user, offer=self.subject)
     Offer.objects.create(user=self.user1, offer=self.subject5)
     update_index.Command().handle(interactive=False)
     users = MatchQuerySet.all(self.user.id)
     self.assertEqual(users[0].offers, [{u'teach django': 1}])
Beispiel #26
0
 def test_highlight_simple_match_interest_query_set(self):
     Interest.objects.create(user=self.user, interest=self.i_subject)
     Interest.objects.create(user=self.user1, interest=self.i_subject1)
     update_index.Command().handle(interactive=False)
     users = MatchQuerySet.all(self.user.id)
     self.assertEqual(users[0].interests, [{u'learn django': 1}])
Beispiel #27
0
 def test_simple_phrase(self):
     s = Subject.objects.create(description='foreign language')
     Goal.objects.get_or_create(user=self.user, goal=s)
     Goal.objects.get_or_create(user=self.user1, goal=s)
     update_index.Command().handle(interactive=False)
     match_users = MatchQuerySet.all(self.user.id, is_filter=True)
Beispiel #28
0
 def test_simple_top_interests_less_than_1(self):
     Goal.objects.create(user=self.user, goal=self.subject)
     Goal.objects.create(user=self.user1, goal=self.subject10)
     update_index.Command().handle(interactive=False)
     match_users = MatchQuerySet.all(self.user.id)
     self.assertEqual(len(match_users), 0)