mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-11-15 07:21:50 +08:00
Do not exclude 1 char gap
This commit is contained in:
parent
8c3429b67c
commit
03428aa50e
@ -3058,15 +3058,22 @@ class SongSelect{
|
||||
var score0 = a[0].score
|
||||
a[0].ranges = this.indexesToRanges(a[0].indexes)
|
||||
if(a[0].indexes.length > 1){
|
||||
if(a[0].ranges.length > a[0].indexes.length / 2){
|
||||
var rangeAmount = a[0].ranges.length
|
||||
var lastIdx = -3
|
||||
a[0].ranges.forEach(range => {
|
||||
if(range[0] - lastIdx <= 2){
|
||||
rangeAmount--
|
||||
score0 -= 1000
|
||||
}
|
||||
lastIdx = range[1]
|
||||
})
|
||||
var index = a[0].target.indexOf(query)
|
||||
if(index === -1){
|
||||
if(index !== -1){
|
||||
a[0].ranges = [[index, index + query.length - 1]]
|
||||
}else if(rangeAmount > a[0].indexes.length / 2){
|
||||
score0 = -Infinity
|
||||
a[0].ranges = null
|
||||
}else{
|
||||
a[0].ranges = [[index, index + query.length - 1]]
|
||||
}
|
||||
}else if(a[0].ranges.length !== 1){
|
||||
}else if(rangeAmount !== 1){
|
||||
score0 -= 9000
|
||||
}
|
||||
}
|
||||
@ -3075,15 +3082,22 @@ class SongSelect{
|
||||
var score1 = a[1].score - 1000
|
||||
a[1].ranges = this.indexesToRanges(a[1].indexes)
|
||||
if(a[1].indexes.length > 1){
|
||||
if(a[1].ranges.length > a[1].indexes.length / 2){
|
||||
var rangeAmount = a[1].ranges.length
|
||||
var lastIdx = -3
|
||||
a[1].ranges.forEach(range => {
|
||||
if(range[0] - lastIdx <= 2){
|
||||
rangeAmount--
|
||||
score1 -= 1000
|
||||
}
|
||||
lastIdx = range[1]
|
||||
})
|
||||
var index = a[1].target.indexOf(query)
|
||||
if(index === -1){
|
||||
if(index !== -1){
|
||||
a[1].ranges = [[index, index + query.length - 1]]
|
||||
}else if(rangeAmount > a[1].indexes.length / 2){
|
||||
score1 = -Infinity
|
||||
a[1].ranges = null
|
||||
}else{
|
||||
a[1].ranges = [[index, index + query.length - 1]]
|
||||
}
|
||||
}else if(a[1].ranges.length !== 1){
|
||||
}else if(rangeAmount !== 1){
|
||||
score1 -= 9000
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user