Skip to content

Commit 4e006d8

Browse files
committed
minor quality of life improvements
1 parent ef3e7c6 commit 4e006d8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

autofill/src/order.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,14 @@ def __attrs_post_init__(self):
102102
@classmethod
103103
def from_element(cls, element: ElementTree.Element) -> "CardImage":
104104
card_dict = unpack_element(element, [x.value for x in constants.DetailsTags])
105-
drive_id = card_dict[constants.CardTags.id].text
105+
drive_id = card_dict[constants.CardTags.id].text.strip(' "')
106106
slots = text_to_list(card_dict[constants.CardTags.slots].text)
107-
name = card_dict[constants.CardTags.name].text
108-
query = card_dict[constants.CardTags.query].text
107+
name = None
108+
if constants.CardTags.name in card_dict.keys():
109+
name = card_dict[constants.CardTags.name].text
110+
query = None
111+
if constants.CardTags.name in card_dict.keys():
112+
query = card_dict[constants.CardTags.query].text
109113
card_image = cls(drive_id=drive_id, slots=slots, name=name, query=query)
110114
return card_image
111115

@@ -180,7 +184,7 @@ def from_element(
180184
if missing_slots:
181185
card_image_collection.cards.append(
182186
CardImage(
183-
drive_id=fill_image_id,
187+
drive_id=fill_image_id.strip(' "'),
184188
slots=list(missing_slots),
185189
)
186190
)

0 commit comments

Comments
 (0)