From 4cc2b574b37407d26e53687d0ca0b00bc3ae412d Mon Sep 17 00:00:00 2001 From: Sophia Mersmann Date: Thu, 24 Dec 2020 16:55:19 +0100 Subject: [PATCH] Sort by the start date --- src/components/Root.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Root.vue b/src/components/Root.vue index a41c185..9ac042b 100644 --- a/src/components/Root.vue +++ b/src/components/Root.vue @@ -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 }, @@ -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 {