示例#1
0
文件: views.py 项目: jatinS-dev/web-1
def new_bounty_daily_preview(request):
    profile = request.user.profile
    keywords = profile.keywords
    hours_back = 2000

    from marketing.mails import get_bounties_for_keywords
    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)
示例#2
0
 def test_get_bounties_for_keywords(self):
     """Test get_bounties_for_keywords function to confirm a bounty reserved for a specific user is excluded."""
     new_bounties, _all_bounties = get_bounties_for_keywords('Python', 24)
     assert new_bounties.count() == 1