fix(ui): remove attachment_type overwrite in loader to preserve parsed type
- Removed code that was overwriting attachment_type for all items - Type is now correctly parsed from API (scope vs sight) - Sights tab now correctly shows items with Type='Sight'
This commit is contained in:
parent
c7afde4d41
commit
7f1e111a83
|
|
@ -33,17 +33,13 @@ class AttachmentLoaderThread(QThread):
|
||||||
# Get amplifiers
|
# Get amplifiers
|
||||||
try:
|
try:
|
||||||
amps = api.get_all_amplifiers()
|
amps = api.get_all_amplifiers()
|
||||||
for amp in amps:
|
|
||||||
amp.attachment_type = "amplifier"
|
|
||||||
all_attachments.extend(amps)
|
all_attachments.extend(amps)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Could not load amplifiers: {e}")
|
logger.warning(f"Could not load amplifiers: {e}")
|
||||||
|
|
||||||
# Get scopes/sights
|
# Get scopes/sights (both come from same endpoint)
|
||||||
try:
|
try:
|
||||||
scopes = api.get_all_scopes()
|
scopes = api.get_all_scopes()
|
||||||
for scope in scopes:
|
|
||||||
scope.attachment_type = "scope"
|
|
||||||
all_attachments.extend(scopes)
|
all_attachments.extend(scopes)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Could not load scopes: {e}")
|
logger.warning(f"Could not load scopes: {e}")
|
||||||
|
|
@ -51,8 +47,6 @@ class AttachmentLoaderThread(QThread):
|
||||||
# Get absorbers
|
# Get absorbers
|
||||||
try:
|
try:
|
||||||
absorbers = api.get_all_absorbers()
|
absorbers = api.get_all_absorbers()
|
||||||
for absorber in absorbers:
|
|
||||||
absorber.attachment_type = "absorber"
|
|
||||||
all_attachments.extend(absorbers)
|
all_attachments.extend(absorbers)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Could not load absorbers: {e}")
|
logger.warning(f"Could not load absorbers: {e}")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue