summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/tracking.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/tracking.py b/modules/tracking.py
index aaa0304..6fa01d7 100644
--- a/modules/tracking.py
+++ b/modules/tracking.py
@@ -220,11 +220,15 @@ class Module:
msg = None
try:
session = Session()
- consignments = session.query(Consignment).filter(and_(Consignment.server == self.irc.factory.server,
- or_(Consignment.code == code, Consignment.label == code)))
+ consignments = session.query(Consignment).outerjoin(Consignment.packages) \
+ .filter(and_(Consignment.server == self.irc.factory.server,
+ or_(Consignment.code == code, Consignment.label == code, Package.code == code)))
if nick:
consignments = consignments.filter(Consignment.nick == nick)
deleted = []
+ consignments = consignments.all()
+ if not len(consignments):
+ raise NoResultFound
# we should have exactly one consignment, but need to handle cases when there are more
for consignment in consignments:
code = str(consignment)