Esempio n. 1
0
def run(project, result):
    """ given a result, call the api with the results"""
    project_score_id = project.get('project_score_id', None)
    if not project_score_id:
        logger.debug("No project_score_id :(")
        return
    score_attrib_slug = result.get('name', None)
    score_attrib = get_score_attribute(score_attrib_slug)
    score_attrib_id = score_attrib.get('id', None)
    value = result.get('value', None)

    if score_attrib_id and project_score_id and value:
        res = send_score(score_attrib_id, project_score_id, value)
        result['project_score_attribute_id'] = res.get('id')
    else:
        logger.debug("Skip")
    logger.debug("Done")
    return result
Esempio n. 2
0
def score(project, result):
    """ given a result, call the api with the results"""
    project_score_id = project.get('project', {}).get('project_score_id', None)
    if not project_score_id:
        logging.info("No project_score_id :(")
    project_score_attribute_id = result[2]
    if not project_score_attribute_id:
        logging.info("No project_score_attribute_id :(")
        return
    score_attrib_slug = result[0]
    score_attrib = get_score_attribute(score_attrib_slug)
    score_attrib_id = score_attrib.get('id', None)
    value = result[1]

    if value:
        send_score(project_score_attribute_id, score_attrib_id,
                   project_score_id, value, result[3])
    else:
        logging.debug("Skip")
    logging.debug("Done")