Skip to content

Commit

Permalink
Fix bug regarding split lists in rest controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
sknull committed Apr 20, 2024
1 parent 965c974 commit ffbf527
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ class HybridStageRestController(
fun hexColor(
@RequestParam(value = "ids", required = false, defaultValue = "") ids: String,
@RequestParam(value = "hexColors") hexColors: String,
@RequestParam(value = "gains", required = false, defaultValue = "") gains: String,
@RequestParam(value = "gains", required = false, defaultValue = "1.0") gains: String,
@RequestParam(value = "transition", required = false) transition: Long?,
@RequestParam(value = "turnOn", required = false, defaultValue = "true") turnOn: Boolean,
@RequestParam(value = "store", required = false, defaultValue = "true") store: Boolean,
@RequestParam(value = "storeName", required = false) storeName: String?
) {
hybridStageService.hexColor(
ids = ids.split(",").map { it.trim() },
hexColors = hexColors.split(",").map { it.trim() },
ids = ids.split(",").map { it.trim() }.filter { it.isNotEmpty() },
hexColors = hexColors.split(",").map { it.trim() }.filter { it.isNotEmpty() },
gains = gains.split(",").map { it.toDouble() },
transition = transition,
turnOn = turnOn,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ class ScenesRestController(
fun hybrid(
@RequestParam(value = "ids", required = false, defaultValue = "") ids: String,
@RequestParam(value = "hexColors", required = false, defaultValue = "") hexColors: String,
@RequestParam(value = "gains", required = false, defaultValue = "") gains: String,
@RequestParam(value = "gains", required = false, defaultValue = "1.0") gains: String,
) {
scenesService.hybrid(
ids = ids.split(",").map { it.trim() },
hexColors = hexColors.split(",").map { it.trim() },
ids = ids.split(",").map { it.trim() }.filter { it.isNotEmpty() },
hexColors = hexColors.split(",").map { it.trim() }.filter { it.isNotEmpty() },
gains = gains.split(",").map { it.toDouble() })
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ class ShellyRestController(
fun hexColor(
@RequestParam(value = "ids", required = false, defaultValue = "") ids: String,
@RequestParam(value = "hexColors") hexColors: String,
@RequestParam(value = "gains", required = false, defaultValue = "") gains: String,
@RequestParam(value = "gains", required = false, defaultValue = "1.0") gains: String,
@RequestParam(value = "transition", required = false) transitionDuration: Long?,
@RequestParam(value = "turnOn", required = false, defaultValue = "true") turnOn: Boolean,
@RequestParam(value = "store", required = false, defaultValue = "true") store: Boolean,
@RequestParam(value = "storeName", required = false) storeName: String?
) {
hybridStageService.hexColor(
ids = ids.split(",").map { it.trim() },
hexColors = hexColors.split(",").map { it.trim() },
ids = ids.split(",").map { it.trim() }.filter { it.isNotEmpty() },
hexColors = hexColors.split(",").map { it.trim() }.filter { it.isNotEmpty() },
gains = gains.split(",").map { it.toDouble() },
transition = transitionDuration,
turnOn = turnOn,
Expand Down

0 comments on commit ffbf527

Please sign in to comment.