This was some return-type mismatch and other breakage from recent
reworking of channel_is_hunt.
if 'Item' in response:
return (response['Item'], table)
else:
if 'Item' in response:
return (response['Item'], table)
else:
def channel_is_puzzle(turb, channel_id, channel_name):
"""Given a channel ID/name return the database item for the puzzle
def channel_is_puzzle(turb, channel_id, channel_name):
"""Given a channel ID/name return the database item for the puzzle
Returns a tuple of (hunt_name, hunt_id) or (None, None)."""
Returns a tuple of (hunt_name, hunt_id) or (None, None)."""
- (hunt, hunts_table) = channel_is_hunt(turb, channel_id)
+ (hunt, _) = channel_is_hunt(turb, channel_id)
if hunt:
return (hunt['hunt_id'], hunt['name'])
if hunt:
return (hunt['hunt_id'], hunt['name'])
# puzzle channel with a hunt-id prefix.
hunt_id = channel_name.split('-')[0]
# puzzle channel with a hunt-id prefix.
hunt_id = channel_name.split('-')[0]
+ hunts_table = turb.db.Table("hunts")
+
response = hunts_table.scan(
FilterExpression='hunt_id = :hunt_id',
ExpressionAttributeValues={':hunt_id': hunt_id}
)
response = hunts_table.scan(
FilterExpression='hunt_id = :hunt_id',
ExpressionAttributeValues={':hunt_id': hunt_id}
)
- if 'Items' in response:
+ if 'Items' in response and len(response['Items']):
item = response['Items'][0]
return (item['hunt_id'], item['name'])
item = response['Items'][0]
return (item['hunt_id'], item['name'])