Example #1
0
def api_sampling_process(response):
    data = request.form
    try:
        unsure = 'unsure' in data
        assert 'sampling_id' in data
        work_item_uuid = data["sampling_id"]
        response = int(response)

        sample_db.save_response(work_item_uuid, response, unsure)
        return 'OK'
    except sqlite3.IntegrityError:
        return "EXISTS"
    except Exception as e:
        return 'ERROR'
Example #2
0
def api_sampling_process(response):
    data = request.form
    try:
        unsure = 'unsure' in data
        assert 'sampling_id' in data
        work_item_uuid = data["sampling_id"]
        response = int(response)

        create_or_update = sample_db.save_response(work_item_uuid, response, unsure)
        if create_or_update == "create":
            flash('Created response for that sample', 'success')
        else:
            flash('Updated response for that sample', 'success')
        return 'OK'
    except Exception as e:
        return 'ERROR'