changeset 2722:027184f05e7f

Now user can check the issues assigned to a particular user
author Saurabh Kathpalia <saurabh.kathpalia95@gmail.com>
date Fri, 15 Aug 2014 01:37:55 +0530
parents 81dd9e00bac1
children f94b80842ada
files MoinMoin/apps/frontend/views.py
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Fri Aug 15 00:19:52 2014 +0530
+++ b/MoinMoin/apps/frontend/views.py	Fri Aug 15 01:37:55 2014 +0530
@@ -58,7 +58,7 @@
 from MoinMoin import user, util
 from MoinMoin.constants.keys import *
 from MoinMoin.constants.namespaces import *
-from MoinMoin.constants.itemtypes import ITEMTYPE_DEFAULT, ITEMTYPE_TICKET
+from MoinMoin.constants.itemtypes import ITEMTYPE_DEFAULT, ITEMTYPE_TICKET, ITEMTYPE_USERPROFILE
 from MoinMoin.constants.chartypes import CHARS_UPPER, CHARS_LOWER
 from MoinMoin.constants.contenttypes import *
 from MoinMoin.util import crypto
@@ -2288,7 +2288,10 @@
 
     selected_tags = set(request.args.getlist(u'selected_tags'))
     terms.extend(Term(TAGS, tag) for tag in selected_tags)
-    q = And(terms)
+    assigned_username = request.args.get(ASSIGNED_TO)
+    user = [Term(NAME, assigned_username)]
+    user.append(Term(CONTENTTYPE, CONTENTTYPE_USER))
+    user = And(user)
 
     with flaskg.storage.indexer.ix[LATEST_REVS].searcher() as searcher:
         sortedby = []
@@ -2297,6 +2300,16 @@
             sortedby.append(sorting.FieldFacet(u'mtime', reverse=True))
         elif time_sorting == u'old':
             sortedby.append(sorting.FieldFacet(u'mtime', reverse=False))
+
+        if assigned_username:
+            selected_user = searcher.search(user, limit=None)
+            if selected_user:
+                assigned_to = selected_user[0][ITEMID]
+                terms.append(Term(ASSIGNED_TO, assigned_to))
+            else:
+                terms = []
+
+        q = And(terms)
         results = searcher.search(q, limit=None, sortedby=sortedby)
         tags = get_itemtype_specific_tags(ITEMTYPE_TICKET)
         return render_template('tickets.html',