fix: results were limited to 3 candidates

pull/100/head
Pierre-Louis Guhur 1 year ago
parent 481f5fcaf9
commit c67f317563

@ -45,7 +45,7 @@ export async function getServerSideProps({ query, locale }) {
]);
if ('msg' in payload) {
return { props: { err: payload.msg, electionRef, ...translations } };
return {props: {err: {message: payload.msg}, electionRef, ...translations}};
}
const numGrades = payload.grades.length;
@ -506,7 +506,6 @@ const ResultPage = ({
const candidateByRank = {};
result.candidates
.filter((c) => c.rank < 4)
.forEach((c) => (candidateByRank[c.rank] = c));
return (

@ -192,7 +192,7 @@ export const updateElection = async (
return {status: 200, ...payload};
} catch (e) {
console.error(e);
return { status: 400, msg: 'Unknown API error' };
return {status: 400, msg: `Unknown API error: ${e}`};
}
};
@ -218,7 +218,7 @@ export const getResults = async (
return {...payload, status: response.status};
} catch (error) {
console.error(error);
return { status: 400, msg: 'Unknown API error' };
return {status: 400, msg: `Unknown API error: ${error}`};
}
};

Loading…
Cancel
Save