From patchwork Fri Sep 11 15:55:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Lespiau X-Patchwork-Id: 516885 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 577B81402ED for ; Sat, 12 Sep 2015 02:02:14 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 15B341A2BAC for ; Sat, 12 Sep 2015 02:02:14 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lists.ozlabs.org (Postfix) with ESMTP id DAE1D1A2BB0 for ; Sat, 12 Sep 2015 01:56:15 +1000 (AEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 11 Sep 2015 08:56:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,511,1437462000"; d="scan'208";a="559867343" Received: from jeffzhua-mobl.amr.corp.intel.com (HELO strange.amr.corp.intel.com) ([10.254.88.85]) by FMSMGA003.fm.intel.com with ESMTP; 11 Sep 2015 08:56:14 -0700 From: Damien Lespiau To: patchwork@lists.ozlabs.org Subject: [PATCH 42/51] series: Add series to the TODO list Date: Fri, 11 Sep 2015 16:55:15 +0100 Message-Id: <1441986924-26689-43-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1441986924-26689-1-git-send-email-damien.lespiau@intel.com> References: <1441986924-26689-1-git-send-email-damien.lespiau@intel.com> X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Because Series object have a reviewer field, they are part of the list of things to be on to TODO list, along with the patches where the user is a delegate. Signed-off-by: Damien Lespiau --- patchwork/models.py | 14 ++++++++++++-- patchwork/templates/patchwork/profile.html | 6 +++--- patchwork/templates/patchwork/todo-list.html | 18 ++++++++++++++++-- patchwork/templates/patchwork/todo-lists.html | 2 +- patchwork/views/user.py | 7 +++++-- templates/base.html | 2 +- 6 files changed, 38 insertions(+), 11 deletions(-) diff --git a/patchwork/models.py b/patchwork/models.py index 1f13722..df9d85f 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -112,8 +112,8 @@ class UserProfile(models.Model): def sync_person(self): pass - def n_todo_patches(self): - return self.todo_patches().count() + def n_todo(self): + return self.todo_patches().count() + self.todo_series().count() def todo_patches(self, project = None): @@ -130,6 +130,16 @@ class UserProfile(models.Model): .values('pk').query) return qs + def todo_series(self, project = None): + # filter on project, if necessary + if project: + qs = Series.objects.filter(project = project) + else: + qs = Series.objects + + qs = qs.filter(reviewer = self.user) + return qs + def __unicode__(self): return self.name() diff --git a/patchwork/templates/patchwork/profile.html b/patchwork/templates/patchwork/profile.html index 116d6d6..d702a0e 100644 --- a/patchwork/templates/patchwork/profile.html +++ b/patchwork/templates/patchwork/profile.html @@ -25,10 +25,10 @@ Contributor to

Todo

-{% if user.profile.n_todo_patches %} +{% if user.profile.n_todo %}

Your todo - list contains {{ user.profile.n_todo_patches }} - patch{{ user.profile.n_todo_patches|pluralize:"es" }}.

+ list contains {{ user.profile.n_todo }} + patch{{ user.profile.n_todo|pluralize:"es" }}.

{% else %}

Your todo list contains patches that have been delegated to you. You have no items in your todo list at present.

diff --git a/patchwork/templates/patchwork/todo-list.html b/patchwork/templates/patchwork/todo-list.html index b301901..c84992e 100644 --- a/patchwork/templates/patchwork/todo-list.html +++ b/patchwork/templates/patchwork/todo-list.html @@ -5,13 +5,27 @@ {% block title %}{{ user }}'s todo list{% endblock %} {% block heading %}{{user}}'s todo list for {{ project.linkname }}{% endblock %} +{% block headers %} + +{% endblock %} + {% block body %} -

A Patchwork Todo-list contains patches that are assigned to you, and -are in an "action required" state +

A Patchwork Todo-list contains series and patches that are assigned to you, +and are in an "action required" state ({% for state in action_required_states %}{% if forloop.last and not forloop.first %} or {% endif %}{{ state }}{% if not forloop.last and not forloop.first %}, {%endif %}{% endfor %}), and are not archived.

+

Series

+ +{% include "patchwork/series-list-table.html" %} + +

Patches

+ {% include "patchwork/patch-list.html" %} {% endblock %} diff --git a/patchwork/templates/patchwork/todo-lists.html b/patchwork/templates/patchwork/todo-lists.html index e268160..cd469a0 100644 --- a/patchwork/templates/patchwork/todo-lists.html +++ b/patchwork/templates/patchwork/todo-lists.html @@ -18,7 +18,7 @@ {{ todo_list.project.name }} - {{ todo_list.n_patches }} + {{ todo_list.n_items }} {% endfor %} diff --git a/patchwork/views/user.py b/patchwork/views/user.py index 126ecc9..3f02aff 100644 --- a/patchwork/views/user.py +++ b/patchwork/views/user.py @@ -185,10 +185,13 @@ def todo_lists(request): for project in Project.objects.all(): patches = request.user.profile.todo_patches(project = project) - if not patches.count(): + series = request.user.profile.todo_series(project=project) + + n_items = patches.count() + series.count() + if not n_items: continue - todo_lists.append({'project': project, 'n_patches': patches.count()}) + todo_lists.append({'project': project, 'n_items': n_items}) if len(todo_lists) == 1: return todo_list(request, todo_lists[0]['project'].linkname) diff --git a/templates/base.html b/templates/base.html index 18c3ef6..a03459f 100644 --- a/templates/base.html +++ b/templates/base.html @@ -59,7 +59,7 @@ {% endif %} {% if user.is_authenticated %}
  • Todo - {{ user.profile.n_todo_patches }} + {{ user.profile.n_todo }}
  • Bundles
  • {% if user.is_staff %}