Skip to content

Commit

Permalink
Merge pull request dimagi#1411 from dimagi/copy_of_isNonCountedRepeat
Browse files Browse the repository at this point in the history
Duplicate of isNonCountedRepeat
  • Loading branch information
shubham1g5 authored Jun 7, 2024
2 parents e5cb43f + 373581e commit d09e72a
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 d09e72a

Please sign in to comment.