forked from FrederikBaerentsen/BrickTracker
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3a014765b |
+3
-4
@@ -4,10 +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 purchase date, price, and notes not being saved when adding an individual minifigure** (Issue #151, branch `bugfix/issue-151`): Filling in purchase date, price, or notes before clicking Add had no effect, only purchase location was saved
|
||||||
- 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`
|
- `BrickMinifigureSocket` was missing references to `#add-purchase-date`, `#add-purchase-price`, and `#add-description`, so those fields were never read or included in the socket emit
|
||||||
- Updated `rebrickable_image.py` to treat empty strings the same as `None` throughout, falling back to the configured nil placeholder image
|
- The backend already supported all three fields. This was just a frontend error
|
||||||
- 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
|
- **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
|
||||||
|
|
||||||
|
|||||||
@@ -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)),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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'],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,12 @@ class BrickMinifigureSocket extends BrickSocket {
|
|||||||
this.html_input = document.getElementById(`${id}-set`);
|
this.html_input = document.getElementById(`${id}-set`);
|
||||||
this.html_no_confim = document.getElementById(`${id}-no-confirm`);
|
this.html_no_confim = document.getElementById(`${id}-no-confirm`);
|
||||||
this.html_owners = document.getElementById(`${id}-owners`);
|
this.html_owners = document.getElementById(`${id}-owners`);
|
||||||
|
this.html_purchase_date = document.getElementById(`${id}-purchase-date`);
|
||||||
|
this.html_purchase_price = document.getElementById(`${id}-purchase-price`);
|
||||||
this.html_purchase_location = document.getElementById(`${id}-purchase-location`);
|
this.html_purchase_location = document.getElementById(`${id}-purchase-location`);
|
||||||
this.html_storage = document.getElementById(`${id}-storage`);
|
this.html_storage = document.getElementById(`${id}-storage`);
|
||||||
this.html_tags = document.getElementById(`${id}-tags`);
|
this.html_tags = document.getElementById(`${id}-tags`);
|
||||||
|
this.html_description = document.getElementById(`${id}-description`);
|
||||||
|
|
||||||
// Card elements
|
// Card elements
|
||||||
this.html_card = document.getElementById(`${id}-card`);
|
this.html_card = document.getElementById(`${id}-card`);
|
||||||
@@ -98,12 +101,28 @@ class BrickMinifigureSocket extends BrickSocket {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab the purchase location
|
// Grab the purchase info
|
||||||
|
let purchase_date = null;
|
||||||
|
if (this.html_purchase_date) {
|
||||||
|
purchase_date = this.html_purchase_date.value || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
let purchase_price = null;
|
||||||
|
if (this.html_purchase_price) {
|
||||||
|
purchase_price = this.html_purchase_price.value || null;
|
||||||
|
}
|
||||||
|
|
||||||
let purchase_location = null;
|
let purchase_location = null;
|
||||||
if (this.html_purchase_location) {
|
if (this.html_purchase_location) {
|
||||||
purchase_location = this.html_purchase_location.value;
|
purchase_location = this.html_purchase_location.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Grab the description (notes)
|
||||||
|
let description = '';
|
||||||
|
if (this.html_description) {
|
||||||
|
description = this.html_description.value || '';
|
||||||
|
}
|
||||||
|
|
||||||
// Grab the storage
|
// Grab the storage
|
||||||
let storage = null;
|
let storage = null;
|
||||||
if (this.html_storage) {
|
if (this.html_storage) {
|
||||||
@@ -129,9 +148,12 @@ class BrickMinifigureSocket extends BrickSocket {
|
|||||||
this.socket.emit(this.messages.IMPORT_MINIFIGURE, {
|
this.socket.emit(this.messages.IMPORT_MINIFIGURE, {
|
||||||
figure: (figure !== undefined) ? figure : this.html_input.value,
|
figure: (figure !== undefined) ? figure : this.html_input.value,
|
||||||
owners: owners,
|
owners: owners,
|
||||||
|
purchase_date: purchase_date,
|
||||||
|
purchase_price: purchase_price,
|
||||||
purchase_location: purchase_location,
|
purchase_location: purchase_location,
|
||||||
storage: storage,
|
storage: storage,
|
||||||
tags: tags,
|
tags: tags,
|
||||||
|
description: description,
|
||||||
quantity: 1
|
quantity: 1
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -235,10 +257,22 @@ class BrickMinifigureSocket extends BrickSocket {
|
|||||||
this.html_owners.querySelectorAll('input').forEach(input => input.disabled = !enabled);
|
this.html_owners.querySelectorAll('input').forEach(input => input.disabled = !enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.html_purchase_date) {
|
||||||
|
this.html_purchase_date.disabled = !enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.html_purchase_price) {
|
||||||
|
this.html_purchase_price.disabled = !enabled;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.html_purchase_location) {
|
if (this.html_purchase_location) {
|
||||||
this.html_purchase_location.disabled = !enabled;
|
this.html_purchase_location.disabled = !enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.html_description) {
|
||||||
|
this.html_description.disabled = !enabled;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.html_storage) {
|
if (this.html_storage) {
|
||||||
this.html_storage.disabled = !enabled;
|
this.html_storage.disabled = !enabled;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user