Skip to content

Commit

Permalink
Prepared interface for user stats
Browse files Browse the repository at this point in the history
  • Loading branch information
Serwios committed Aug 1, 2024
1 parent 858b76b commit 3fc7794
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
@EnableScheduling
public class CommunityApplication {
public static void main(String[] args) {

SpringApplication.run(CommunityApplication.class, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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;
Expand Down

0 comments on commit 3fc7794

Please sign in to comment.