1
0

Integrated the demand table into the Calculate.jsx

This commit is contained in:
Mathias Wagner 2023-11-22 13:42:41 +01:00
parent e6b9ed19b4
commit 74a9243e8d
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -21,7 +21,7 @@ const localeOptions = {
export const Calculate = ({setState, currentRound}) => {
const {round, getGroupById, updateCapital, endRound, setRoundHistory} = useContext(GroupContext);
const {rounds} = useContext(SettingsContext);
const {rounds, demandTable} = useContext(SettingsContext);
const navigate = useNavigate();
@ -84,7 +84,13 @@ export const Calculate = ({setState, currentRound}) => {
avg /= amount;
setNachfrage(avg < 1800 ? 50 : avg > 2200 ? 30 : 40);
let nachfrage = 0;
for (let key in demandTable) {
if (avg >= parseInt(key)) nachfrage = demandTable[key];
}
setNachfrage(nachfrage);
setAnimatedGroups([]);
}, []);