Skip to content

Commit

Permalink
add end button
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobasco99 committed Jun 13, 2024
1 parent 56dd935 commit a82adc1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,12 @@ public Response calculateNextAction(String intent, String message, String messag
// check if participant has completed the survey
boolean participantDone = this.completedsurvey;
if (participantDone){
JSONObject button = new JSONObject();
button.put("intent", "Ende");
button.put("label", "Ende");
button.put("description", "Ende");
button.put("isFile", false);
response.put("interactiveElements", new JSONArray().add(button));
System.out.println("participant done");
response.put("message", completedSurvey);
response.put("contextOn", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1432,9 +1432,15 @@ public Response nextQuestion(String input) {

System.out.println("Participant has completed survey");
// no unfinished survey left
JSONObject button = new JSONObject();
button.put("intent", "Ende");
button.put("label", "Ende");
button.put("description", "Ende");
button.put("isFile", false);
String completedSurvey = SurveyHandlerService.texts.get("completedSurveyDE");
response.put("message", completedSurvey);
response.put("contextOn", false);
response.put("interactiveElements", new JSONArray().add(button));
Context.get().monitorEvent(MonitoringEvent.RESPONSE_SENDING.toString());
return Response.ok().entity(response).build();
}
Expand Down

0 comments on commit a82adc1

Please sign in to comment.