<commit_before>from decimal import Decimal
from django.db.models import Q
from core.services.mail_services import *
from core.services import watch_services
from core.utils.frespo_utils import dictOrEmpty, validateURL, validateIssueURL, get_or_none
from core.models import Issue, Project, Offer, Solution, IssueComment, OfferComment
from core.utils.trackers_adapter import fetchIssueInfo
import logging

logger = logging.getLogger(__name__)

__author__ = 'tony'

def search_issues(project_id=None, project_name=None, search_terms='', is_public_suggestion=None):
    issues = Issue.objects.filter(Q(is_feedback=False) | Q(offer__isnull=False))
    if is_public_suggestion != None:
        issues = issues.filter(is_public_suggestion=is_public_suggestion)
    if project_id:
        issues = issues.filter(project__id=project_id)
    elif project_name:
        issues = issues.filter(project__name__icontains=project_name)
    if search_terms:
        issues = issues.filter(title__icontains=search_terms)
    issues = issues.order_by('-creationDate')
    return issues


def sponsor_new_issue(dict, user):
    offer = _buildOfferFromDictionary(dict, user)
    if(offer.issue.project):
        offer.issue.project.save()
        offer.issue.project = offer.issue.project
    if(not offer.issue.id):
        offer.issue.save()
        offer.issue = offer.issue
    offer.save()
    msg = "offer: " + str(offer.price) + "\n<br>" +\
          "issue key: " + offer.issue.key + "\n<br>" +\
          "issue title: " + offer.issue.title + "\n<br>"
    if(offer.issue.project):<commit_msg>woops, bugfix didn't work quite right<commit_after>from decimal import Decimal
from django.db.models import Q
from core.services.mail_services import *
from core.services import watch_services
from core.utils.frespo_utils import dictOrEmpty, validateURL, validateIssueURL, get_or_none
from core.models import Issue, Project, Offer, Solution, IssueComment, OfferComment
from core.utils.trackers_adapter import fetchIssueInfo
import logging

logger = logging.getLogger(__name__)

__author__ = 'tony'

def search_issues(project_id=None, project_name=None, search_terms='', is_public_suggestion=None):
    issues = Issue.objects.filter(Q(is_feedback=False) | Q(offer__isnull=False)) #woops
    issues = Issue.objects.filter(Q(is_feedback=False))
    if is_public_suggestion != None:
        issues = issues.filter(is_public_suggestion=is_public_suggestion)
    if project_id:
        issues = issues.filter(project__id=project_id)
    elif project_name:
        issues = issues.filter(project__name__icontains=project_name)
    if search_terms:
        issues = issues.filter(title__icontains=search_terms)
    issues = issues.order_by('-creationDate')
    return issues


def sponsor_new_issue(dict, user):
    offer = _buildOfferFromDictionary(dict, user)
    if(offer.issue.project):
        offer.issue.project.save()
        offer.issue.project = offer.issue.project
    if(not offer.issue.id):
        offer.issue.save()
        offer.issue = offer.issue
    offer.save()
    msg = "offer: " + str(offer.price) + "\n<br>" +\
          "issue key: " + offer.issue.key + "\n<br>" +\
          "issue title: " + offer.issue.title + "\n<br>"
    if(offer.issue.project):
{'fraction_non_alphanumeric': 0.10864881502000616, 'fraction_numerical': 0.0, 'mean_word_length': 4.078125, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5517299', 'n_tokens_mistral': 1035, 'n_tokens_neox': 992, 'n_words': 205}