

def ab_experiment_complete(key, userKey, result):
    active_experiment = db.ab_experiments.find({
        'User': userKey,
        'Experiment': key,
        'Result': {
            '$exists': False,
        },
    }, {
        '_id': 1,
    }).sort('Begin', (- 1)).limit(1)[0]
    db.ab_experiments.update({
        '_id': active_experiment['_id'],
    }, {
        '$set': {
            'Result': active_experiment,
        },
    })

dataset/ETHPy150Open cpfair/tapiriik/tapiriik/web/views/ab.py ab_experiment_complete/VarMisuse@102/135 `result`->`active_experiment`