룰렛 최대 개수 수정
AS-IS : 최대 6개 TO-BE : 최대 10개 룰렛 확률 수정 AS-IS : 소수점 없음 TO-BE : 소수점 2자리
This commit is contained in:
@@ -49,7 +49,7 @@ final class RouletteSettingsViewModel: ObservableObject {
|
||||
}
|
||||
|
||||
func addOption() {
|
||||
if (options.count >= 6) {
|
||||
if (options.count >= 10) {
|
||||
return
|
||||
}
|
||||
options.append(RouletteOption(title: "", weight: 1))
|
||||
@@ -72,7 +72,8 @@ final class RouletteSettingsViewModel: ObservableObject {
|
||||
guard totalWeight > 0 else { return }
|
||||
|
||||
for i in 0..<options.count {
|
||||
options[i].percentage = Int(Double(options[i].weight) / Double(totalWeight) * 100)
|
||||
let percent = floor(Double(options[i].weight) / Double(totalWeight) * 10000) / 100
|
||||
options[i].percentage = String(format: "%.2f", percent)
|
||||
}
|
||||
|
||||
removeAllAndAddOptions(options: options)
|
||||
|
Reference in New Issue
Block a user