Skip to content

Commit

Permalink
add idx
Browse files Browse the repository at this point in the history
  • Loading branch information
Herkarl committed Feb 11, 2024
1 parent 865349d commit 94d0537
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
15 changes: 11 additions & 4 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,11 @@ router.get('/stats', function(req, res) {
return usermandates[b].days - usermandates[a].days;
}
return usermandates[b].count - usermandates[a].count;
}).map(function(key) {
return usermandates[key];
}).map(function(key, index) {
return {
...usermandates[key],
idx: index+1
};
});

// Total days for each user on a mandate
Expand All @@ -222,9 +225,13 @@ router.get('/stats', function(req, res) {
return usermandates[b].count - usermandates[a].count;
}
return usermandates[b].days - usermandates[a].days;
}).map(function(key) {
return usermandates[key];
}).map(function(key, index) {
return {
...usermandates[key],
idx: index+1
};
});


// Pagination logic
const page = parseInt(req.query.page) || 1;
Expand Down
14 changes: 10 additions & 4 deletions views/stats.pug
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ block content

table(id='mandateCountTable', style=`${sorting == "count" ? "" : "display: none;"}`)
thead
tr
tr
th
th Användare
th Antal mandat
th Antal dagar
tbody
each user in paginatedItems
tr
td
=user.idx
td
a(href='/user/' + user.user.kthid)
=user.user.first_name + " " + user.user.last_name
Expand All @@ -48,12 +51,15 @@ block content
table(id='daysOnMandateTable', style=`${sorting == "days" ? "" : "display: none;"}`)
thead
tr
th Användare
th Antal mandat
th Antal dagar
th
th Användare
th Antal mandat
th Antal dagar
tbody
each user in paginatedItems
tr
td
=user.idx
td
a(href='/user/' + user.user.kthid)
=user.user.first_name + " " + user.user.last_name
Expand Down

0 comments on commit 94d0537

Please sign in to comment.