Skip to content

Commit

Permalink
fix: tracking number with multiple subjects search (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
firstof9 authored Jul 15, 2021
2 parents 6d178c2 + cf34ea7 commit bc3cd1b
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions custom_components/mail_and_packages/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,6 @@ def get_count(
result = {}
today = get_formatted_date()
track = None
data = None

# Return Amazon delivered info
if sensor_type == const.AMAZON_DELIVERED:
Expand Down Expand Up @@ -790,16 +789,16 @@ def get_count(
count,
)

if (
const.ATTR_PATTERN
in const.SENSOR_DATA[f"{sensor_type.split('_')[0]}_tracking"].keys()
):
track = const.SENSOR_DATA[f"{sensor_type.split('_')[0]}_tracking"][
const.ATTR_PATTERN
][0]
if (
const.ATTR_PATTERN
in const.SENSOR_DATA[f"{sensor_type.split('_')[0]}_tracking"].keys()
):
track = const.SENSOR_DATA[f"{sensor_type.split('_')[0]}_tracking"][
const.ATTR_PATTERN
][0]

if track is not None and get_tracking_num and count > 0:
tracking = get_tracking(data[0], account, track)
if track is not None and get_tracking_num and count > 0:
tracking = get_tracking(data[0], account, track)

if len(tracking) > 0:
# Use tracking numbers found for count (more accurate)
Expand Down

0 comments on commit bc3cd1b

Please sign in to comment.