Skip to content

Commit

Permalink
Sort by the start date
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Dec 24, 2020
1 parent 68a1c85 commit 4cc2b57
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/Root.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const DEFAULT = {
sortOptions: [
{ label: 'Sort alphabetically', value: 'alphabetically', active: true },
{ label: 'Sort by the number of requests', value: 'requestCount', active: false },
{ label: 'Sort by start date', value: 'startDate', active: false },
],
requestTypes: [
{ label: 'All', value: 'all', active: true },
Expand All @@ -77,11 +78,12 @@ const DEFAULT = {
const SORT_FUNCS = {
alphabetically: (a, b) => ascending(a.body, b.body)
|| ascending(a.dates.start, b.dates.start),
|| descending(a.dates.start, b.dates.start),
requestCount: (a, b) => descending(
a.requests.get('all').length / sum(a.elections, (d) => d.seats),
b.requests.get('all').length / sum(b.elections, (d) => d.seats),
),
startDate: (a, b) => descending(a.dates.start, b.dates.start),
};
export default {
Expand Down

0 comments on commit 4cc2b57

Please sign in to comment.