Esempio n. 1
0
def new_bounty_daily(bounties, old_bounties, to_emails=None):
    if not bounties:
        return
    max_bounties = 10
    if len(bounties) > max_bounties:
        bounties = bounties[0:max_bounties]
    if to_emails is None:
        to_emails = []
    plural = "s" if len(bounties) != 1 else ""
    worth = round(
        sum([
            bounty.value_in_usdt for bounty in bounties if bounty.value_in_usdt
        ]), 2)
    worth = f" worth ${worth}" if worth else ""
    subject = _(
        f"⚡️  {len(bounties)} New Open Funded Issue{plural}{worth} matching your profile"
    )

    for to_email in to_emails:
        cur_language = translation.get_language()
        try:
            setup_lang(to_email)
            from_email = settings.CONTACT_EMAIL
            html, text = render_new_bounty(to_email, bounties, old_bounties)

            if not should_suppress_notification_email(
                    to_email, 'new_bounty_notifications'):
                send_mail(from_email,
                          to_email,
                          subject,
                          text,
                          html,
                          categories=['marketing', func_name()])
        finally:
            translation.activate(cur_language)
Esempio n. 2
0
def new_bounty_daily_preview(request):
    profile = request.user.profile
    keywords = profile.keywords
    hours_back = 2000
    new_bounties, all_bounties = get_bounties_for_keywords(keywords, hours_back)
    quests = trending_quests()
    response_html, _ = render_new_bounty('*****@*****.**', new_bounties, all_bounties, offset=3, trending_quests=quests)
    return HttpResponse(response_html)
Esempio n. 3
0
def new_bounty_daily_preview(request):
    profile = request.user.profile
    keywords = profile.keywords
    hours_back = 2000

    new_bounties, all_bounties = get_bounties_for_keywords(keywords, hours_back)
    max_bounties = 5
    if len(new_bounties) > max_bounties:
        new_bounties = new_bounties[0:max_bounties]
    response_html, _ = render_new_bounty(settings.CONTACT_EMAIL, new_bounties, old_bounties='', offset=3, quest_of_the_day=quest_of_the_day(), upcoming_grant=upcoming_grant(), upcoming_hackathon=upcoming_hackathon(), latest_activities=latest_activities(request.user))
    return HttpResponse(response_html)
Esempio n. 4
0
def new_bounty(bounty, to_emails=None):
    if not bounty or not bounty.value_in_usdt:
        return

    if to_emails is None:
        to_emails = []

    subject = "⚡️ New Funded Issue Match worth ${} ({})".format(bounty.value_in_usdt, bounty.keywords)

    for to_email in to_emails:
        from_email = settings.CONTACT_EMAIL
        html, text = render_new_bounty(to_email, bounty)

        if not should_suppress_notification_email(to_email):
            send_mail(from_email, to_email, subject, text, html)
Esempio n. 5
0
def new_bounty(bounty, to_emails=None):
    if not bounty or not bounty.value_in_usdt:
        return

    if to_emails is None:
        to_emails = []

    subject = f"⚡️ New Funded Issue Match worth {bounty.value_in_usdt} USD @ " \
              f"${convert_token_to_usdt(bounty.token_name)}/{bounty.token_name} {bounty.keywords})"

    for to_email in to_emails:
        from_email = settings.CONTACT_EMAIL
        html, text = render_new_bounty(to_email, bounty)

        if not should_suppress_notification_email(to_email):
            send_mail(from_email, to_email, subject, text, html)
Esempio n. 6
0
def new_bounty(bounties, to_emails=None):
    if not bounties:
        return
    max_bounties = 10
    if len(bounties) > max_bounties:
        bounties = bounties[0:max_bounties]
    if to_emails is None:
        to_emails = []
    plural = "s" if len(bounties) != 1 else ""
    worth = round(
        sum([
            bounty.value_in_usdt for bounty in bounties if bounty.value_in_usdt
        ]), 2)
    worth = f" worth ${worth}" if worth else ""
    subject = _(
        f"⚡️  {len(bounties)} New Funded Issue{plural}{worth} matching your profile"
    )

    for to_email in to_emails:
        from_email = settings.CONTACT_EMAIL
        html, text = render_new_bounty(to_email, bounties)

        if not should_suppress_notification_email(to_email):
            send_mail(from_email, to_email, subject, text, html)