diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2014-04-08 21:42:14 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2014-04-08 21:42:14 +0200 |
commit | 82024b1352c667532245a36cd6361ba7a7e44d36 (patch) | |
tree | 1a8870ac9d7bb2a561ee1d17a55cc107ce63e7dc | |
parent | 71e9281823cc905c8885cf8a998a669d55726acf (diff) |
tracking: Fix conflict check regression (since 9a2671c).
-rw-r--r-- | modules/tracking.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/tracking.py b/modules/tracking.py index 8083182..f408359 100644 --- a/modules/tracking.py +++ b/modules/tracking.py @@ -552,6 +552,16 @@ url [TRACKINGNO] - Lists URLs for matches to the corresponding website''') # don't add delivered packages if data.delivered: continue + try: + conflicts = session.query(Consignment).join(Consignment.packages) \ + .filter(and_(Package.code == data.code, Consignment.type != consignment.type)).all() + except NoResultFound: + pass + else: + if len(conflicts): + self.irc.msg(target, '%s: %s conflicts with another consignment' % consignment.nick.encode('utf-8'), consignment) + removed = True + break package = Package(consignment.id, data.code) session.add(package) try: |