fix(sonar): sort rotated voice list in separate statement (javascript:S4043)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
32aac96c9a
commit
544db8883c
@ -1283,7 +1283,8 @@ $('reh-matchonline-btn')?.addEventListener('click', async () => {
|
|||||||
if (!nameHit && cands.length > 1) {
|
if (!nameHit && cands.length > 1) {
|
||||||
const taken = new Set(Object.values(rehState.cast).map(c => (c.online?.candidates?.[c.online.picked]?.sample_audio)).filter(Boolean));
|
const taken = new Set(Object.values(rehState.cast).map(c => (c.online?.candidates?.[c.online.picked]?.sample_audio)).filter(Boolean));
|
||||||
const rotated = [...cands.slice(i % cands.length), ...cands.slice(0, i % cands.length)];
|
const rotated = [...cands.slice(i % cands.length), ...cands.slice(0, i % cands.length)];
|
||||||
cands = rotated.sort((a, b) => (taken.has(a.sample_audio) ? 1 : 0) - (taken.has(b.sample_audio) ? 1 : 0));
|
rotated.sort((a, b) => (taken.has(a.sample_audio) ? 1 : 0) - (taken.has(b.sample_audio) ? 1 : 0));
|
||||||
|
cands = rotated;
|
||||||
}
|
}
|
||||||
if (cands.length) {
|
if (cands.length) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user