better sorting

This commit is contained in:
Craig 2020-02-11 19:48:30 +00:00
parent 6db53d8c48
commit 92f2156eef

View File

@ -106,7 +106,7 @@ export const mutations = mutationTree(state, {
if (width >= 600 && height >= 300) { if (width >= 600 && height >= 300) {
for (const j of Object.keys(rates)) { for (const j of Object.keys(rates)) {
const rate = rates[j] const rate = rates[j]
if (rate >= 15 && rate <= 60) { if (rate === 30 || rate === 60) {
data.push({ data.push({
width, width,
height, 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) { setVolume(state, volume: number) {