Merge branch 'master' of https://github.com/LukasNowy/SmartShopper
This commit is contained in:
		@@ -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,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user