Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds method to check for non counted Repeat Group at current index #1408

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
}
}
Loading