-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
web: add cron service to update 'has_planned_review' field on patches
Signed-off-by: andrepapoti <[email protected]>
- Loading branch information
1 parent
909fb55
commit 2eb1ae1
Showing
4 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Patchwork - automated patch tracking system | ||
# Copyright (C) 2015 Jeremy Kerr <[email protected]> | ||
# | ||
# SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
from django.core.management.base import BaseCommand | ||
from patchwork.models import Patch | ||
from patchwork.api.patch import PatchReviewIntentionSerializer | ||
|
||
|
||
class Command(BaseCommand): | ||
help = 'Updates the patch has_planned_review field' | ||
|
||
def handle(self, *args, **kwargs): | ||
for patch in Patch.objects.all(): | ||
has_planned_review = False | ||
for ( | ||
patch_interest | ||
) in patch.planning_to_review.through.objects.filter(patch=patch): | ||
serializer = PatchReviewIntentionSerializer(patch_interest) | ||
if not serializer.data['is_stale']: | ||
has_planned_review = True | ||
break | ||
patch.has_planned_review = has_planned_review | ||
patch.save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
DATABASE_HOST=db | ||
DATABASE_PORT=3306 | ||
DATABASE_NAME=patchwork | ||
DATABASE_USER=patchwork | ||
DATABASE_PASSWORD=password | ||
* * * * * /opt/pyenv/shims/python patchwork/manage.py update_reviewers > /proc/1/fd/1 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters