improve range parsing

This commit is contained in:
Bui 2022-02-27 18:23:20 +00:00
parent a763028fa7
commit 70a047cd1c

View File

@ -2896,9 +2896,12 @@ class SongSelect{
parseRange(string){ parseRange(string){
var range = string.split("-") var range = string.split("-")
if(range.length == 1){ if(range.length == 1){
return {min: parseInt(range[0]), max: parseInt(range[0])} var min = parseInt(range[0]) || 0
return min > 0 ? {min: min, max: min} : false
} else if(range.length == 2){ } else if(range.length == 2){
return {min: parseInt(range[0]), max: parseInt(range[1])} var min = parseInt(range[0]) || 0
var max = parseInt(range[1]) || 0
return min > 0 && max > 0 ? {min: min, max: max} : false
} }
} }
@ -2918,10 +2921,12 @@ class SongSelect{
case "hard": case "hard":
case "oni": case "oni":
case "ura": case "ura":
filters[parts[0]] = this.parseRange(parts[1]) var range = this.parseRange(parts[1])
if (range) { filters[parts[0]] = range }
break break
case "extreme": case "extreme":
filters.oni = this.parseRange(parts[1]) var range = this.parseRange(parts[1])
if (range) { filters.oni = this.parseRange(parts[1]) }
break break
case "clear": case "clear":
case "silver": case "silver":