def get_new_crashing_bids()

in crashclouseau/utils.py [0:0]


def get_new_crashing_bids(numbers, ndays, threshold):
    """Get the crashing buildids (according to the numbers)
    and keep it if the number of installs is less than threshold"""
    data = [(k, v["count"]) for k, v in numbers.items()]
    data = sorted(data)
    nums = [n for _, n in data]
    res = {}
    big = False
    for i in get_spike_indices(nums, ndays):
        day, count = data[i]
        if count >= 500:
            big = True
        bids = numbers[day]["bids"]
        for bid, n in sorted(bids.items()):
            if n and numbers[day]["installs"][bid] >= threshold:
                res[bid] = n
                break
    return res, big