mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-10 00:28:22 -05:00
fixed category change entry updaet
This commit is contained in:
@@ -187,7 +187,6 @@ class SpaceFilterSerializer(serializers.ListSerializer):
|
||||
data = []
|
||||
else:
|
||||
iterable = data.all() if hasattr(data, 'all') else data
|
||||
try:
|
||||
if isinstance(iterable, list) or (isinstance(iterable, QuerySet) and getattr(iterable, '_result_cache', None) is not None):
|
||||
data = [d for d in iterable if d.userspace.space.id == self.context['request'].space.id]
|
||||
else:
|
||||
@@ -196,9 +195,6 @@ class SpaceFilterSerializer(serializers.ListSerializer):
|
||||
else:
|
||||
# not sure why but this branch can be hit (just normal page load, need to see why)
|
||||
data = data.filter(userspace__space=self.context['request'].user.get_active_space()).all()
|
||||
except Exception:
|
||||
# not sure why but this branch can be hit (just normal page load, need to see why)
|
||||
data = data.filter(userspace__space=self.context['request'].user.get_active_space()).all()
|
||||
elif isinstance(data, list):
|
||||
data = [d for d in data if getattr(d, self.child.Meta.model.get_space_key()[0]) == self.context['request'].space]
|
||||
else:
|
||||
|
||||
@@ -174,6 +174,7 @@ const isShoppingLineDelayed = computed(() => {
|
||||
function categoryUpdate(category: SupermarketCategory) {
|
||||
const api = new ApiApi()
|
||||
shoppingListFood.value.food.supermarketCategory = category
|
||||
shoppingListFood.value.entries.forEach(e => e.food.supermarketCategory = category)
|
||||
useShoppingStore().updateEntriesStructure()
|
||||
api.apiFoodUpdate({id: shoppingListFood.value.food.id, food: shoppingListFood.value.food}).then(r => {
|
||||
useMessageStore().addPreparedMessage(PreparedMessage.UPDATE_SUCCESS)
|
||||
|
||||
@@ -234,6 +234,9 @@ export const useShoppingStore = defineStore(_STORE_ID, () => {
|
||||
r.results.forEach((e) => {
|
||||
entries.value.set(e.id!, e)
|
||||
})
|
||||
if(r.results.length > 0){
|
||||
updateEntriesStructure()
|
||||
}
|
||||
currentlyUpdating.value = false
|
||||
}).catch((err: any) => {
|
||||
currentlyUpdating.value = false
|
||||
|
||||
Reference in New Issue
Block a user