def calculate_recommendeds_first():
    from django.db import connection
    crsr = connection.cursor()
    
    _prime_linksearch_tbl(include_recommended_done = True)
    profiles = UserProfile.objects.filter(is_recommended_calc = False)
    
    for profile in profiles:
        can_calculate_recs = False
        if LinkVote.objects.filter(user = profile.user).count() > 5:
            can_calculate_recs = True
        if Link.objects.filter(user = profile.user).count() > 5:
            can_calculate_recs = True
        if not can_calculate_recs:
            continue
        try:
            populate_recommended_link(profile.user.username)
        except:
            raise
    
        profile.recommended_calc = datetime.now()
        profile.is_recommended_calc = True
        profile.save()
Calculate recommended links for new users, who never had a recommended calculation done.
dataset/ETHPy150Open agiliq/django-socialnews/socialnews/news/cron.py/calculate_recommendeds_first