<commit_before>from aspen import Response
from gittip import AMOUNTS
from gittip.utils import get_participant


tip_suggestions = ('jeresig', 'antirez', 'wycats', 'fabpot', 'mitsuhiko',
                   'jtauber', 'kennethreitz', 'alex', 'taylorotwell')
tip_suggestions = [{'tippee': name, 'amount': 0} for name in tip_suggestions]


def _extract_username(tip):
    if tip['platform'] == 'github':
        key = 'login'
    else:
        assert tip['platform'] == 'twitter', tip  # sanity check
        key = 'screen_name'
    return tip['user_info'][key]

# ========================================================================== ^L
participant = get_participant(request, restrict=True)

backed_amount = participant.get_dollars_receiving()
giving_chart, npatrons, contributed = \
                                           participant.get_chart_of_receiving()
tips, total, unclaimed_tips, unclaimed_total = \
                                           participant.get_giving_for_profile()
suggest_tips = (total == 0) and (user == participant)
if suggest_tips:
    tips = tip_suggestions

assert backed_amount == contributed, (backed_amount, contributed)


username = participant.id   # used in footer shared with on/$platform/ pages
hero = "Giving"
title = "%s - %s" % (participant.id, hero)
locked = False

# ========================================================================== ^L
{% extends "templates/profile.html" %}<commit_msg>Fix regressions in /giving/ page; #597<commit_after>from aspen import Response
from gittip import AMOUNTS
from gittip.utils import get_participant


tip_suggestions = ('jeresig', 'antirez', 'wycats', 'fabpot', 'mitsuhiko',
                   'jtauber', 'kennethreitz', 'alex', 'taylorotwell')
tip_suggestions = [{'tippee': name, 'amount': 0} for name in tip_suggestions]


def _extract_username(tip):
    if tip['platform'] == 'github':
        key = 'login'
    else:
        assert tip['platform'] == 'twitter', tip  # sanity check
        key = 'screen_name'
    return tip['user_info'][key]

# ========================================================================== ^L
participant = get_participant(request, restrict=True)
tips, total, unclaimed_tips, unclaimed_total = \
                                           participant.get_giving_for_profile()
suggest_tips = (total == 0) and (user == participant)
if suggest_tips:
    tips = tip_suggestions
hero = "Giving"
title = "%s - %s" % (participant.id, hero)
locked = False

# ========================================================================== ^L
{% extends "templates/profile.html" %}
{'fraction_non_alphanumeric': 0.22552043176561296, 'fraction_numerical': 0.0026985350809560524, 'mean_word_length': 3.9054820415879017, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1543608', 'n_tokens_mistral': 788, 'n_tokens_neox': 709, 'n_words': 185}