Skip to content
Snippets Groups Projects
Commit 4b6d59ec authored by Alexis POYEN's avatar Alexis POYEN
Browse files

Merge branch '42-rank-number' into 'master'

Resolve "Rank number"

Closes #42

See merge request apoyen/elections!38
parents b4729545 e35cb4a0
No related branches found
No related tags found
1 merge request!38Resolve "Rank number"
Pipeline #5923 passed
No preview for this file type
......@@ -186,15 +186,23 @@ class CandidateList {
</div> `;
let candidates = await this.updateCandidates();
candidates.sort(function (a, b) {
return a.Rank > b.Rank;
});
const markup = candidates
.map((candidate) => this.candidateTemplate(candidate))
.join("");
document.getElementById("candidates").innerHTML = markup;
let newRank = 1;
candidates.forEach((candidate) => {
if (candidate.Rank >= newRank) newRank = candidate.Rank + 1;
});
let candidate = {
ID: 0,
FullName: "",
Rank: 0,
Rank: newRank,
CommunityCounseller: false,
Birthdate: "2000-01-01",
PotentialIncompatibility: false,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment