From 9e2a5d34e601ef30c50c4e24ae93a67f549b55ab Mon Sep 17 00:00:00 2001 From: j50ju <155741428+j50ju@users.noreply.github.com> Date: Mon, 21 Oct 2024 10:07:01 +0800 Subject: [PATCH] Update MABHandler.java Make it return a selected arm correctly --- .../xprize/robotutor/tutorengine/util/MABHandler.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/cmu/xprize/robotutor/tutorengine/util/MABHandler.java b/app/src/main/java/cmu/xprize/robotutor/tutorengine/util/MABHandler.java index c829bd10..53e9cf76 100644 --- a/app/src/main/java/cmu/xprize/robotutor/tutorengine/util/MABHandler.java +++ b/app/src/main/java/cmu/xprize/robotutor/tutorengine/util/MABHandler.java @@ -33,9 +33,14 @@ public class MABHandler { public static String getArm(String dataSource, IScope2 scope) { List arms = getarms(dataSource, scope); Arm selectedArm = selectArm(arms); - Log.d(TAG, "getArm: list = " + arms); - Log.d(TAG, "getArm: selected = " + selectedArm); - return ""; + // Ensure that selected arm is not null + if (selectedArm != null) { + Log.d(TAG, "getArm: selected = " + selectedArm.name); + return selectedArm.name; + } else { + Log.e(TAG, "getArm: No arm was selected"); + return "default_arm"; + } } // Selects an arm from a list of arms