diff --git a/backend/src/main/java/net/alex9849/cocktailpi/model/eventaction/EventTrigger.java b/backend/src/main/java/net/alex9849/cocktailpi/model/eventaction/EventTrigger.java index 82253f5a..d83f11f3 100644 --- a/backend/src/main/java/net/alex9849/cocktailpi/model/eventaction/EventTrigger.java +++ b/backend/src/main/java/net/alex9849/cocktailpi/model/eventaction/EventTrigger.java @@ -2,6 +2,7 @@ public enum EventTrigger { COCKTAIL_PRODUCTION_STARTED, COCKTAIL_PRODUCTION_MANUAL_INTERACTION_REQUESTED, + COCKTAIL_PRODUCTION_MANUAL_INTERACTION_COMPLETED, COCKTAIL_PRODUCTION_FINISHED, COCKTAIL_PRODUCTION_CANCELED, APPLICATION_STARTUP; } diff --git a/backend/src/main/java/net/alex9849/cocktailpi/service/pumps/CocktailOrderService.java b/backend/src/main/java/net/alex9849/cocktailpi/service/pumps/CocktailOrderService.java index 53d3aca1..b9db7465 100644 --- a/backend/src/main/java/net/alex9849/cocktailpi/service/pumps/CocktailOrderService.java +++ b/backend/src/main/java/net/alex9849/cocktailpi/service/pumps/CocktailOrderService.java @@ -31,6 +31,7 @@ @Transactional public class CocktailOrderService { private CocktailFactory cocktailFactory; + private CocktailProgress prevCocktailProgress; private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); @@ -84,6 +85,7 @@ private void onCocktailProgressSubscriptionChange(CocktailProgress progress) { if(progress.getState() == CocktailProgress.State.CANCELLED || progress.getState() == CocktailProgress.State.FINISHED) { this.scheduler.schedule(() -> { this.cocktailFactory = null; + this.prevCocktailProgress = null; this.webSocketService.broadcastCurrentCocktailProgress(null); this.pumpUpService.reschedulePumpBack(); }, 5000, TimeUnit.MILLISECONDS); @@ -107,6 +109,15 @@ private void onCocktailProgressSubscriptionChange(CocktailProgress progress) { eventService.triggerActions(EventTrigger.COCKTAIL_PRODUCTION_FINISHED); break; } + if(prevCocktailProgress != null) { + if(prevCocktailProgress.getState() == CocktailProgress.State.MANUAL_ACTION_REQUIRED + || prevCocktailProgress.getState() == CocktailProgress.State.MANUAL_INGREDIENT_ADD) { + if(progress.getState() == CocktailProgress.State.RUNNING) { + eventService.triggerActions(EventTrigger.COCKTAIL_PRODUCTION_MANUAL_INTERACTION_COMPLETED); + } + } + } + prevCocktailProgress = progress; } public FeasibilityFactory checkFeasibility(Recipe recipe, CocktailOrderConfiguration orderConfig) { diff --git a/frontend/src/i18n/de/index.js b/frontend/src/i18n/de/index.js index ac49d412..1db07778 100644 --- a/frontend/src/i18n/de/index.js +++ b/frontend/src/i18n/de/index.js @@ -1087,6 +1087,7 @@ export default { event_action_trigger_display_names: { cocktail_prod_started: 'Cocktail-Produktion gestartet', cocktail_prod_manual_interaction_requested: 'Manuelle Interaktion bei Cocktail-Produktion angefordert', + cocktail_prod_manual_interaction_completed: 'Manuelle Interaktion bei Cocktail-Produktion abgeschlossen', cocktail_prod_finished: 'Cocktail-Produktion beendet', cocktail_prod_canceled: 'Cocktail-Produktion abgebrochen', application_started: 'Anwendung gestartet' diff --git a/frontend/src/i18n/en_US/index.js b/frontend/src/i18n/en_US/index.js index af780016..8a3a9a33 100644 --- a/frontend/src/i18n/en_US/index.js +++ b/frontend/src/i18n/en_US/index.js @@ -1170,6 +1170,7 @@ export default { event_action_trigger_display_names: { cocktail_prod_started: 'Cocktail production started', cocktail_prod_manual_interaction_requested: 'Cocktail production manual interaction requested', + cocktail_prod_manual_interaction_completed: 'Cocktail production manual interaction completed', cocktail_prod_finished: 'Cocktail production finished', cocktail_prod_canceled: 'Cocktail production canceled', application_started: 'Application started' diff --git a/frontend/src/mixins/constants.js b/frontend/src/mixins/constants.js index 5e685e20..a77d9524 100644 --- a/frontend/src/mixins/constants.js +++ b/frontend/src/mixins/constants.js @@ -8,6 +8,9 @@ export const eventActionTriggerDisplayNames = { }, { label: this.$t('constants.event_action_trigger_display_names.cocktail_prod_manual_interaction_requested'), value: 'COCKTAIL_PRODUCTION_MANUAL_INTERACTION_REQUESTED' + }, { + label: this.$t('constants.event_action_trigger_display_names.cocktail_prod_manual_interaction_completed'), + value: 'COCKTAIL_PRODUCTION_MANUAL_INTERACTION_COMPLETED' }, { label: this.$t('constants.event_action_trigger_display_names.cocktail_prod_finished'), value: 'COCKTAIL_PRODUCTION_FINISHED'