Skip to content

Commit

Permalink
Merge pull request #1408 from dimagi/isNonCountedRepeat
Browse files Browse the repository at this point in the history
Adds method to check for non counted Repeat Group at current index
  • Loading branch information
shubham1g5 authored Jun 7, 2024
2 parents 5844562 + 3f106d4 commit 9242d2c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/org/javarosa/core/model/FormDef.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Vector;

Expand Down Expand Up @@ -1855,4 +1854,13 @@ public String dispatchSendCallout(String url, Multimap<String, String> paramMap)
return sendCalloutHandler.performHttpCalloutForResponse(url, paramMap);
}
}

// Checks if the form element at given form Index belongs to a non counted repeat
public boolean isNonCountedRepeat(FormIndex formIndex) {
IFormElement currentElement = getChild(formIndex);
if (currentElement instanceof GroupDef && ((GroupDef)currentElement).isRepeat()) {
return ((GroupDef)currentElement).getCountReference() == null;
}
return false;
}
}
4 changes: 4 additions & 0 deletions src/main/java/org/javarosa/form/api/FormEntryModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -625,4 +625,8 @@ public String getDebugInfo(FormIndex index, String category) {
return TraceSerialization.serializeEvaluationTrace(indexDebug.get(category),
TraceSerialization.TraceInfoType.FULL_PROFILE, false);
}

public boolean isNonCountedRepeat() {
return getForm().isNonCountedRepeat(getFormIndex());
}
}

0 comments on commit 9242d2c

Please sign in to comment.