Opened 17 years ago

Last modified 17 years ago

#1298 closed defect

blocking "44" makes "#4" blocked — at Initial Version

Reported by: phpxcache Owned by: Noah Kantrowitz
Priority: normal Component: MasterTicketsPlugin
Severity: major Keywords:
Cc: chris@…, paresh.solanki@…, Jeffrey Hulten Trac Release: 0.10

Description

when i fill "blocking" with "44" in #123, ticket "#4" is blocked by "#123", i'm sure this is wrong.

Index: mastertickets/util.py
===================================================================
--- mastertickets/util.py   (revision 2071)
+++ mastertickets/util.py   (working copy)
@@ -10,10 +10,15 @@
     db = env.get_db_cnx()
     cursor = db.cursor()

-    cursor.execute('SELECT ticket FROM ticket_custom WHERE name=%s AND (value LIKE %s OR value LIKE %s)',
+    cursor.execute('SELECT ticket,value FROM ticket_custom WHERE name=%s AND (value LIKE %s OR value LIKE %s)',
                    ('blocking', '%%%s,%%'%tkt, '%%%s'%tkt))
-    blocking_ids = [row[0] for row in cursor]
+    blocking_ids = []
+    for row in cursor:
+        (ticket, value) = row
+        blocks = value.split(',')
+        if tkt in blocks:
+            blocking_ids.append(ticket)
     return blocking_ids

 def linkify_ids(env, req, ids):
-    return Markup(', '.join([unicode(html.A('#%s'%i, href=req.href.ticket(i), class_='%s ticket'%Ticket(env, i)['status'])) for i in ids]))
\ No newline at end of file
+    return Markup(', '.join([unicode(html.A('#%s'%i, href=req.href.ticket(i), class_='%s ticket'%Ticket(env, i)['status'])) for i in ids]))
Index: setup.py

there is nice sql function FIND_IN_SET() but is mysql specified (not sure)

Change History (0)

Note: See TracTickets for help on using tickets.