diff --git a/src/main/java/com/archivision/community/CommunityApplication.java b/src/main/java/com/archivision/community/CommunityApplication.java index 6ab1adf..7846e55 100644 --- a/src/main/java/com/archivision/community/CommunityApplication.java +++ b/src/main/java/com/archivision/community/CommunityApplication.java @@ -8,7 +8,6 @@ @EnableScheduling public class CommunityApplication { public static void main(String[] args) { - SpringApplication.run(CommunityApplication.class, args); } } diff --git a/src/main/java/com/archivision/community/state/impl/MatchStateHandler.java b/src/main/java/com/archivision/community/state/impl/MatchStateHandler.java index 87451b6..5d64bc0 100644 --- a/src/main/java/com/archivision/community/state/impl/MatchStateHandler.java +++ b/src/main/java/com/archivision/community/state/impl/MatchStateHandler.java @@ -49,7 +49,6 @@ public void doHandle(Message message) { userService.changeState(chatId, UserFlowState.SETTINGS); } if (messageText.equals(Reply.STATS.toString())) { - // how to trigger execution of another state immediayl (without sending explicit message) messageSender.sendMsgWithMarkup(chatId, "Статистика", keyboardBuilder.backButton()); userService.changeState(chatId, UserFlowState.STATS); } diff --git a/src/main/java/com/archivision/community/state/impl/StatsStateHandler.java b/src/main/java/com/archivision/community/state/impl/StatsStateHandler.java index 1398cd4..b366215 100644 --- a/src/main/java/com/archivision/community/state/impl/StatsStateHandler.java +++ b/src/main/java/com/archivision/community/state/impl/StatsStateHandler.java @@ -36,12 +36,8 @@ public StatsStateHandler(InputValidator inputValidator, UserService userService, public void doHandle(Message message) { final Long chatId = message.getChatId(); - messageSender.sendTextMessage(chatId, getStatsResponseMessage()); - if (message.getText().equals(Reply.BACK.toString())) { messageSender.sendTextMessage(chatId, "Повертаємось до анкет"); - - // should be returned not to MATCH but to place where all info is ready userService.changeState(chatId, UserFlowState.MATCH); } } @@ -50,6 +46,11 @@ private String getStatsResponseMessage() { return String.format(STATS_TEMPLATE, userStatsService.resolveUserPopularityIndex()); } + @Override + public void onStateChanged(Long chatId) { + messageSender.sendTextMessage(chatId, getStatsResponseMessage()); + } + @Override public UserFlowState getState() { return UserFlowState.STATS;