Exemple #1
0
def get_job_by_service_and_job_id(service_id, job_id):
    job = dao_get_job_by_service_id_and_job_id(service_id, job_id)
    statistics = dao_get_notification_outcomes_for_job(service_id, job_id)
    data = job_schema.dump(job).data

    data['statistics'] = [{'status': statistic[1], 'count': statistic[0]} for statistic in statistics]

    return jsonify(data=data)
Exemple #2
0
def cancel_letter_job(service_id, job_id):
    job = dao_get_job_by_service_id_and_job_id(service_id, job_id)
    can_we_cancel, errors = can_letter_job_be_cancelled(job)
    if can_we_cancel:
        data = dao_cancel_letter_job(job)
        return jsonify(data), 200
    else:
        return jsonify(message=errors), 400
Exemple #3
0
def get_job_by_service_and_job_id(service_id, job_id):
    job = dao_get_job_by_service_id_and_job_id(service_id, job_id)
    statistics = dao_get_notification_outcomes_for_job(service_id, job_id)
    data = job_schema.dump(job).data

    data['statistics'] = [{'status': statistic[1], 'count': statistic[0]} for statistic in statistics]

    return jsonify(data=data)
Exemple #4
0
def test_get_job_by_id(sample_job):
    job_from_db = dao_get_job_by_service_id_and_job_id(sample_job.service.id,
                                                       sample_job.id)
    assert sample_job == job_from_db
def get_notification_count_for_job_id(service_id, job_id):
    dao_get_job_by_service_id_and_job_id(service_id, job_id)
    count = dao_get_notification_count_for_job_id(job_id=job_id)
    return jsonify(count=count), 200
def test_get_job_by_id(sample_job):
    job_from_db = dao_get_job_by_service_id_and_job_id(sample_job.service.id, sample_job.id)
    assert sample_job == job_from_db