Beispiel #1
0
def prepare_violations(task_id):
    """Prepare violations"""
    task = Tasks.find_one(task_id)
    task['violations'] = map(_prepare_violation, task['violations'])
    task['status'] = const.STATUS_SUCCESS if all([
        violation.get('status') != const.STATUS_FAILED
        for violation in task['violations']
    ]) else const.STATUS_FAILED
    success_percents = [
        violation['success_percent'] for violation in task['violations']
    ]
    task['success_percent'] = sum(success_percents) / len(success_percents)\
        if success_percents else 100
    Tasks.save(task)

    mark_commit_with_status.delay(task_id)
    if task.get('pull_request_id'):
        comment_pull_request.delay(task_id)
    comment_lines.delay(task_id)

    project = Project.objects.get(name=task['project'])
    project.update_week_statistic()
    project.update_day_time_statistic()
    project.update_quality_game(task)

    sender.send(
        type='task',
        owner=task['owner_id'],
        task=str(task_id),
        project=task['project'],
    )
Beispiel #2
0
def prepare_violations(task_id):
    """Prepare violations"""
    task = Tasks.find_one(task_id)
    task['violations'] = map(_prepare_violation, task['violations'])
    task['status'] = const.STATUS_SUCCESS if all([
        violation.get('status') != const.STATUS_FAILED
        for violation in task['violations']
    ]) else const.STATUS_FAILED
    success_percents = [
        violation['success_percent'] for violation in task['violations']
    ]
    task['success_percent'] = sum(success_percents) / len(success_percents)\
        if success_percents else 100
    Tasks.save(task)

    mark_commit_with_status.delay(task_id)
    if task.get('pull_request_id'):
        comment_pull_request.delay(task_id)
    comment_lines.delay(task_id)

    project = Project.objects.get(name=task['project'])
    project.update_week_statistic()
    project.update_day_time_statistic()

    sender.send(
        type='task', owner=task['owner_id'],
        task=str(task_id), project=task['project'],
    )
Beispiel #3
0
def prepare_violations(task_id):
    """Prepare violations"""
    task = Tasks.find_one(task_id)
    task["violations"] = map(_prepare_violation, task["violations"])
    task["status"] = (
        const.STATUS_SUCCESS
        if all([violation.get("status") != const.STATUS_FAILED for violation in task["violations"]])
        else const.STATUS_FAILED
    )
    success_percents = [violation["success_percent"] for violation in task["violations"]]
    task["success_percent"] = sum(success_percents) / len(success_percents) if success_percents else 100
    Tasks.save(task)

    mark_commit_with_status.delay(task_id)
    if task.get("pull_request_id"):
        comment_pull_request.delay(task_id)
    comment_lines.delay(task_id)

    project = Project.objects.get(name=task["project"])
    project.update_week_statistic()
    project.update_day_time_statistic()
    project.update_quality_game(task)

    sender.send(type="task", owner=task["owner_id"], task=str(task_id), project=task["project"])
 def update_detail(self, object_list, bundle):
     sender.send(
         type='project', owner=bundle.request.user.id,
     )
     return bundle.obj.can_change(bundle.request.user)
 def update_detail(self, object_list, bundle):
     sender.send(
         type='project',
         owner=bundle.request.user.id,
     )
     return bundle.obj.can_change(bundle.request.user)