Skip to content

Commit

Permalink
Fix a problem with sending actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nbirillo committed Aug 20, 2024
1 parent b7e6229 commit 4d2511c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ internal fun clearKitchen() {
SaladBowlImpl.reset()
BlenderImpl.reset()
KitchenImpl.reset()
}

fun clearActions() {
actions.clear()
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class CookingFunction(val service: CookingService) {
@CrossOrigin
@GetMapping("/tomato-soup")
fun tomatoSoup(): List<Action> {
clearActions()
if (FridgeImpl.vegetables.count{ it.type == VegetableType.Tomato && it.isFresh } < NUMBER_OF_TOMATOES) {
// Show an error
return emptyList()
Expand All @@ -34,6 +35,7 @@ class CookingFunction(val service: CookingService) {
@CrossOrigin
@GetMapping("/soup-spices")
fun soupSpices(): List<Action> {
clearActions()
service.cookWithSpices()
clearKitchen()
return actions
Expand All @@ -46,6 +48,7 @@ class CookingFunction(val service: CookingService) {
@CrossOrigin
@GetMapping("/test-task3")
fun task3(): List<Action> {
clearActions()
service.cookSalad()
clearKitchen()
return actions
Expand All @@ -54,6 +57,7 @@ class CookingFunction(val service: CookingService) {
@CrossOrigin
@GetMapping("/test-task4")
fun task4(): List<Action> {
clearActions()
service.cookSmoothie()
clearKitchen()
return actions
Expand Down

0 comments on commit 4d2511c

Please sign in to comment.