Beispiel #1
0
def request_pairing(num_rounds=10, cutoff=95, exclude=None):
    q = Pairing.all()
    q = q.filter_by(decided=False)
    if exclude is not None:
        q = q.filter(~Pairing.id.in_(exclude))
    q = q.order_by(Pairing.score.desc())

    next_ = q.first()
    if next_ is not None:
        return next_

    next_ = generate_best_random_pairing(num_rounds=num_rounds,
                                         cutoff=cutoff)
    generate_pairings.delay()
    return next_