[SYNC]
This commit is contained in:
@@ -196,10 +196,22 @@ class AstromicFormController extends FormController {
|
||||
}
|
||||
|
||||
int getInstanceCount(String targetGroupID) {
|
||||
String? p = getFullPathOfGroup(targetGroupID);
|
||||
if (p != null && p.split('->').length > 1 && p.split('->').indexOf(targetGroupID) != 0) {
|
||||
// This is a subgroup
|
||||
}
|
||||
FormGroupStructure? structure = getGroupStructure(targetGroupID);
|
||||
if (structure != null) {
|
||||
String firstField = structure.fields.first;
|
||||
return controllers.keys.where((String c) => RegExp(standeredGroupFormat(targetGroupID, r'[\d+]', firstField)).hasMatch(c)).nonNulls.toList().length;
|
||||
// return controllers.keys.where((String c) => RegExp(standeredGroupFormat(targetGroupID, r'[\d+]', firstField)).hasMatch(c)).nonNulls.toList().length;
|
||||
return controllers.keys
|
||||
.where((String c) {
|
||||
// Match the specific group ID and field name within the group
|
||||
final RegExp pattern = RegExp(r'^' + RegExp.escape(standeredGroupFormat(targetGroupID, r'[\d+]', firstField)) + r'(-#\d+)?$');
|
||||
return pattern.hasMatch(c);
|
||||
})
|
||||
.nonNulls
|
||||
.toList().length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user