Compare commits

..

1 Commits

5 changed files with 23 additions and 22 deletions
+3 -5
View File
@@ -4,11 +4,9 @@
### Bug Fixes ### Bug Fixes
- **Fixed crash when importing sets containing minifigures or parts with no image on Rebrickable** (Issue #149c, branch `bugfix/issue-149c`): Adding or refreshing a set would fail entirely if any minifigure or part had no image URL, with error `Invalid URL '': No scheme supplied` - **Fixed "Reset to Defaults" blanking all settings instead of restoring them** (Issue #149a, branch `bugfix/issue-149a`): "Reset to Defaults" was clearing all fields to empty/false instead of populating them with their actual default values
- Rebrickable returns an empty string (not `None`) for missing images; normalize empty strings to `None` at the point of ingestion in `rebrickable_minifigure.py` and `individual_minifigure.py`, matching the existing pattern in `rebrickable_set.py` - `resetToDefaults()` now reads from `window.DEFAULT_CONFIG` and restores each field to its proper default, matching the same logic used on initial page load
- Updated `rebrickable_image.py` to treat empty strings the same as `None` throughout, falling back to the configured nil placeholder image - **Fixed deleting a wish with an owner assigned** (Issue #152, branch `bugfix/issue-152`): Resolved foreign key constraint error when removing a set from the wishlist that had an owner assigned
- Note: the originally reported sets could no longer reproduce the crash (images may have since been added on Rebrickable), so this fix is based on asumptions only
- **Fixed deleting a wish with an owner assigned** (Issue #152): Resolved foreign key constraint error when removing a set from the wishlist that had an owner assigned
- Wish owners are now deleted before the wish itself, respecting the FK constraint - Wish owners are now deleted before the wish itself, respecting the FK constraint
## 1.4 ## 1.4
+1 -1
View File
@@ -543,6 +543,6 @@ class IndividualMinifigure(RebrickableMinifigure):
'figure': str(data['set_num']), 'figure': str(data['set_num']),
'number': int(number), 'number': int(number),
'name': str(data['set_name']), 'name': str(data['set_name']),
'image': str(data['set_img_url']) if data.get('set_img_url') else None, 'image': data.get('set_img_url'),
'number_of_parts': int(data.get('num_parts', 0)), 'number_of_parts': int(data.get('num_parts', 0)),
} }
+4 -4
View File
@@ -55,7 +55,7 @@ class RebrickableImage(object):
# Get the URL (this handles nil images via url() method) # Get the URL (this handles nil images via url() method)
url = self.url() url = self.url()
if not url: if url is None:
return return
# Grab the image # Grab the image
@@ -88,7 +88,7 @@ class RebrickableImage(object):
return self.part.fields.image_id return self.part.fields.image_id
if self.minifigure is not None: if self.minifigure is not None:
if not self.minifigure.fields.image: if self.minifigure.fields.image is None:
return RebrickableImage.nil_minifigure_name() return RebrickableImage.nil_minifigure_name()
else: else:
return self.minifigure.fields.figure return self.minifigure.fields.figure
@@ -113,13 +113,13 @@ class RebrickableImage(object):
# Return the url depending on the objects provided # Return the url depending on the objects provided
def url(self, /) -> str: def url(self, /) -> str:
if self.part is not None: if self.part is not None:
if not self.part.fields.image: if self.part.fields.image is None:
return current_app.config['REBRICKABLE_IMAGE_NIL'] return current_app.config['REBRICKABLE_IMAGE_NIL']
else: else:
return self.part.fields.image return self.part.fields.image
if self.minifigure is not None: if self.minifigure is not None:
if not self.minifigure.fields.image: if self.minifigure.fields.image is None:
return current_app.config['REBRICKABLE_IMAGE_NIL_MINIFIGURE'] return current_app.config['REBRICKABLE_IMAGE_NIL_MINIFIGURE']
else: else:
return self.minifigure.fields.image return self.minifigure.fields.image
+1 -1
View File
@@ -110,5 +110,5 @@ class RebrickableMinifigure(BrickRecord):
'number': int(number), 'number': int(number),
'name': str(data['set_name']), 'name': str(data['set_name']),
'quantity': int(data['quantity']), 'quantity': int(data['quantity']),
'image': str(data['set_img_url']) if data['set_img_url'] else None, 'image': data['set_img_url'],
} }
+14 -11
View File
@@ -285,18 +285,21 @@ function saveLiveConfiguration() {
function resetToDefaults() { function resetToDefaults() {
console.log('Resetting to defaults'); console.log('Resetting to defaults');
// Reset all form inputs Object.keys(window.DEFAULT_CONFIG).forEach(varName => {
document.querySelectorAll('.config-toggle, .config-number, .config-text').forEach(input => { const defaultValue = window.DEFAULT_CONFIG[varName];
if (input.type === 'checkbox') {
input.checked = false;
} else {
input.value = '';
}
});
// Update badges const toggle = document.getElementById(varName);
Object.keys(window.CURRENT_CONFIG).forEach(varName => { if (toggle && toggle.type === 'checkbox') {
updateConfigBadge(varName, null); toggle.checked = defaultValue === true;
}
document.querySelectorAll(`input[data-var="${varName}"]:not(.config-static)`).forEach(input => {
if (input.type !== 'checkbox') {
input.value = defaultValue !== null && defaultValue !== undefined ? defaultValue : '';
}
});
updateConfigBadge(varName, defaultValue);
}); });
// Show status message // Show status message