Merge pull request #7 from ColinMcKechney/final_ava

Final ava
This commit is contained in:
Ava DeCroix
2023-05-03 14:55:21 -04:00
committed by GitHub
2 changed files with 34 additions and 1 deletions

View File

@@ -133,6 +133,7 @@ const changeSearchHandler = evt => {
const submitSearchHandler = evt => { const submitSearchHandler = evt => {
evt.preventDefault(); evt.preventDefault();
setSearchItems([]);
console.log(search_term) console.log(search_term)
console.log(net_id) console.log(net_id)
Axios.post("http://3.219.93.142:8000/api/menu_search", Axios.post("http://3.219.93.142:8000/api/menu_search",
@@ -312,7 +313,7 @@ color: 'main',
/> />
</TableCell> </TableCell>
<TableCell> {searchitem.eatery_id}</TableCell> <TableCell> {searchitem.eatery_name}</TableCell>
<TableCell> {searchitem.item_name}</TableCell> <TableCell> {searchitem.item_name}</TableCell>
<TableCell> {searchitem.serving_size}</TableCell> <TableCell> {searchitem.serving_size}</TableCell>
</TableRow> </TableRow>

View File

@@ -175,6 +175,36 @@ const net_id = ReactSession.get("net_id");
}); });
} }
//Send sums to results if it is Saturday
const sendResults = () => {
var day = planDay();
if (day === 7){
Axios.post('http://3.219.93.142:8000/api/results',
{
net_id: ReactSession.get("net_id"),
week_date: weekStart(),
total_cal: Number(sum.total_cal),
total_fat: Number(sum.total_fat),
total_sat_fat: Number(sum.total_sat_fat),
total_trans_fat: Number(sum.total_trans_fat),
total_carbs: Number(sum.total_carbs),
total_fiber: Number(sum.total_fiber),
total_sugar: Number(sum.total_sugar),
total_protein: Number(sum.total_protein),
total_sodium: Number(sum.total_sodium),
total_potassium: Number(sum.total_potassium),
total_cholesterol: Number(sum.total_cholesterol),}
).then((response) => {
console.log(response);
});
console.log("results sent");
}
}
//Set color variables for chips //Set color variables for chips
const [cals, setCals] = useState(false); const [cals, setCals] = useState(false);
@@ -286,6 +316,8 @@ const net_id = ReactSession.get("net_id");
setColors() setColors()
console.log('Colors set') console.log('Colors set')
console.log(planDay()) console.log(planDay())
sendResults()
}, []); }, []);