From 92f2156eef41525a7e45bd722fa687f3b675a8fe Mon Sep 17 00:00:00 2001 From: Craig Date: Tue, 11 Feb 2020 19:48:30 +0000 Subject: [PATCH] better sorting --- client/src/store/video.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/client/src/store/video.ts b/client/src/store/video.ts index b8b83857..45d7add6 100644 --- a/client/src/store/video.ts +++ b/client/src/store/video.ts @@ -106,7 +106,7 @@ export const mutations = mutationTree(state, { if (width >= 600 && height >= 300) { for (const j of Object.keys(rates)) { const rate = rates[j] - if (rate >= 15 && rate <= 60) { + if (rate === 30 || rate === 60) { data.push({ width, height, @@ -117,7 +117,14 @@ export const mutations = mutationTree(state, { } } - state.configurations = data.sort((a, b) => (b.width === a.width ? b.rate - a.rate : b.width - a.width)) + state.configurations = data.sort((a, b) => { + if (b.width === a.width && b.height == a.height) { + return b.rate - a.rate + } else if (b.width === a.width) { + return b.height - a.height + } + return b.width - a.width + }) }, setVolume(state, volume: number) {