From 4f5898bb664e33be81f7a392e2cc742b8600ae8f Mon Sep 17 00:00:00 2001 From: Martin Riese Date: Thu, 21 Mar 2024 14:20:08 -0500 Subject: [PATCH 1/4] Add log for missing entity when navigating to next menu --- .../org/commcare/formplayer/services/MenuSessionFactory.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java b/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java index 067e3ee58..bfe662200 100644 --- a/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java +++ b/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java @@ -125,6 +125,9 @@ public void rebuildSessionFromFrame(MenuSession menuSession, CaseSearchHelper ca currentStep = step.getValue(); processedSteps.add(step); needsFullInit = ++processedStepsCount == steps.size(); + } else { + log.error("could not get %s=%s from entity screen references" + .formatted(neededDatum.getDataId(), step.getValue())); } break; } From a6f5ad5afb5a694db3ccc6fa0cde14c60050b494 Mon Sep 17 00:00:00 2001 From: Martin Riese Date: Fri, 22 Mar 2024 11:14:31 -0500 Subject: [PATCH 2/4] Log available refs --- .../formplayer/services/MenuSessionFactory.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java b/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java index bfe662200..955d1f3f9 100644 --- a/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java +++ b/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java @@ -12,6 +12,7 @@ import org.commcare.formplayer.objects.SerializableMenuSession; import org.commcare.formplayer.session.MenuSession; import org.commcare.session.CommCareSession; +import org.commcare.suite.model.EntityDatum; import org.commcare.session.SessionFrame; import org.commcare.suite.model.MenuDisplayable; import org.commcare.suite.model.RemoteQueryDatum; @@ -126,8 +127,20 @@ public void rebuildSessionFromFrame(MenuSession menuSession, CaseSearchHelper ca processedSteps.add(step); needsFullInit = ++processedStepsCount == steps.size(); } else { - log.error("could not get %s=%s from entity screen references" - .formatted(neededDatum.getDataId(), step.getValue())); + StringBuilder sb = new StringBuilder(); + entityScreen.getReferences().forEach(ref -> { + String refStr = + EntityScreen.getReturnValueFromSelection( + ref, + (EntityDatum) neededDatum, + entityScreen.getEvalContext()); + sb.append(refStr); + sb.append("\n"); + }); + + String refs = entityScreen.getReferences().toString(); + log.error("could not get %s=%s from entity screen references: \n%s" + .formatted(neededDatum.getDataId(), step.getValue(), sb.toString())); } break; } From dea1757091607a79f141cd4e4b77bb90f5a037d0 Mon Sep 17 00:00:00 2001 From: Martin Riese Date: Fri, 22 Mar 2024 14:26:31 -0500 Subject: [PATCH 3/4] Make clear when refs end --- .../org/commcare/formplayer/services/MenuSessionFactory.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java b/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java index 955d1f3f9..a4e47ba57 100644 --- a/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java +++ b/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java @@ -134,9 +134,11 @@ public void rebuildSessionFromFrame(MenuSession menuSession, CaseSearchHelper ca ref, (EntityDatum) neededDatum, entityScreen.getEvalContext()); + sb.append(" "); sb.append(refStr); - sb.append("\n"); + sb.append(",\n"); }); + sb.append("]"); String refs = entityScreen.getReferences().toString(); log.error("could not get %s=%s from entity screen references: \n%s" From 89db1aac4a1f928e1a054f56eba21b9282a253bf Mon Sep 17 00:00:00 2001 From: Martin Riese Date: Mon, 25 Mar 2024 12:16:50 -0500 Subject: [PATCH 4/4] Add node set to log --- .../formplayer/services/MenuSessionFactory.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java b/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java index a4e47ba57..e2c523747 100644 --- a/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java +++ b/src/main/java/org/commcare/formplayer/services/MenuSessionFactory.java @@ -127,22 +127,21 @@ public void rebuildSessionFromFrame(MenuSession menuSession, CaseSearchHelper ca processedSteps.add(step); needsFullInit = ++processedStepsCount == steps.size(); } else { - StringBuilder sb = new StringBuilder(); + StringBuilder refsSb = new StringBuilder("["); entityScreen.getReferences().forEach(ref -> { String refStr = EntityScreen.getReturnValueFromSelection( ref, (EntityDatum) neededDatum, entityScreen.getEvalContext()); - sb.append(" "); - sb.append(refStr); - sb.append(",\n"); + refsSb.append(" "); + refsSb.append(refStr); + refsSb.append(",\n"); }); - sb.append("]"); + refsSb.append("]"); - String refs = entityScreen.getReferences().toString(); - log.error("could not get %s=%s from entity screen references: \n%s" - .formatted(neededDatum.getDataId(), step.getValue(), sb.toString())); + log.error("could not get %s=%s from entity screen.\nnode set: %s\nreferences: \n%s" + .formatted(neededDatum.getDataId(), step.getValue(), ((EntityDatum) neededDatum).getNodeset().toString(), refsSb.toString())); } break; }