From 82024b1352c667532245a36cd6361ba7a7e44d36 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Tue, 8 Apr 2014 21:42:14 +0200 Subject: tracking: Fix conflict check regression (since 9a2671c). --- modules/tracking.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'modules') 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: -- cgit v1.2.3