fix: 베팅 시 key 정렬을 숫자 정렬로

This commit is contained in:
2022-01-27 19:13:10 +09:00
parent 319ae449fd
commit a8ba2872e1
2 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ class Bet extends \sammo\BaseAPI
return '필요한 선택 수를 채우지 못했습니다.';
}
sort($bettingType, SORT_NUMERIC);
$bettingType = array_unique($bettingType, SORT_NUMERIC);//NOTE: key로 바로 사용하므로 중요함
if(count($bettingType) != $bettingInfo->selectCnt){
return '중복된 값이 있습니다.';
+5 -4
View File
@@ -48,7 +48,9 @@
fontWeight: myBettings.has(betType) ? 'bold' : undefined
}"
>{{ getTypeStr(betType) }}</div>
<div class="col-3 col-md-6">{{ amount.toLocaleString() }}{{ myBettings.has(betType)?`(${myBettings.get(betType)?.toLocaleString()})`:'' }}</div>
<div
class="col-3 col-md-6"
>{{ amount.toLocaleString() }}{{ myBettings.has(betType) ? `(${myBettings.get(betType)?.toLocaleString()})` : '' }}</div>
<div class="col-3 col-md-3">{{ (bettingAmount / amount).toFixed(2) }}</div>
</div>
</div>
@@ -178,9 +180,8 @@ function toggleCandidate(idx: number) {
return;
}
const typeArr = Array.from(choosedBetType.value.values());
choosedBetTypeKey.value = JSON.stringify(typeArr.sort());
choosedBetTypeKey.value = JSON.stringify(typeArr.sort((lhs, rhs) => lhs - rhs));
}
async function loadBetting(bettingID: number) {
@@ -236,7 +237,7 @@ async function loadBetting(bettingID: number) {
choosedBetTypeKey.value = '[]';
myBettings.value.clear();
for(const [betType, amount] of result.myBetting){
for (const [betType, amount] of result.myBetting) {
myBettings.value.set(betType, amount);
}