detailansicht verbessert
This commit is contained in:
parent
9e28c0fa32
commit
07ecceb27e
@ -84,7 +84,7 @@ async function displayShoppinglist(sl_id) {
|
|||||||
try {
|
try {
|
||||||
let groups = await query('SELECT row_to_json("Group") AS obj FROM "Group" JOIN "Shoppinglist" USING (sl_id) WHERE sl_id = $1;', [sl_id]);
|
let groups = await query('SELECT row_to_json("Group") AS obj FROM "Group" JOIN "Shoppinglist" USING (sl_id) WHERE sl_id = $1;', [sl_id]);
|
||||||
let items = await query('SELECT row_to_json("Item") AS obj FROM "Item" JOIN "Group" USING (group_id) WHERE "Group".sl_id = $1;', [sl_id]);
|
let items = await query('SELECT row_to_json("Item") AS obj FROM "Item" JOIN "Group" USING (group_id) WHERE "Group".sl_id = $1;', [sl_id]);
|
||||||
return items_in_groups(groups, items);
|
return items_in_groups(groups, items, sl_id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -173,13 +173,16 @@ function generate_item_id() {
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
function items_in_groups(groups, items) {
|
function items_in_groups(groups, items, sl_id) {
|
||||||
|
|
||||||
let result = [];
|
let result = {
|
||||||
|
sl_id: sl_id,
|
||||||
|
groups: []
|
||||||
|
};
|
||||||
|
|
||||||
for(let item of groups) {
|
for(let item of groups) {
|
||||||
|
|
||||||
result.push({
|
result.groups.push({
|
||||||
group_id: item.group_id,
|
group_id: item.group_id,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
color: item.color,
|
color: item.color,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user