ввод флага для конфигураций, учитывать только группы
This commit is contained in:
2025-03-18 19:26:32 +03:00
parent afaaaba1e7
commit 3f4ef5f198
11 changed files with 77 additions and 26 deletions

View File

@@ -14,13 +14,16 @@ import _VisualDVM.TestingSystem.Common.Test.Test;
import java.util.LinkedHashMap;
import java.util.Vector;
public class ConfigurationCache extends VisualCache {
public GroupsJson groupsJson = null;
public TestsJson testsJson = null;
public int groupsOnly = 0;
public SettingsArrayJson settingsJson = null;
public String settingsSummary = null;
public Vector<String> groupsSummary = null;
//--
public ConfigurationCache(Configuration configuration) {
groupsOnly = configuration.groupsOnly;
if (configuration.packedGroupsJson.isEmpty())
groupsJson = new GroupsJson(); //просто пустой
else
@@ -57,7 +60,9 @@ public class ConfigurationCache extends VisualCache {
settingsSummary = String.join(";", settingsDescriptionsVector);
}
public int getTestsCount() {
return testsJson.array.size();
return getTests().size();
// testsJson.array.size(); временно, до обновления БД.
}
public Vector<Group> getGroups() {
Vector<Group> groups = new Vector<>();
@@ -69,20 +74,30 @@ public class ConfigurationCache extends VisualCache {
}
public Vector<Test> getTests() {
Vector<Test> tests = new Vector<>();
for (TestJson testJson : testsJson.array) {
if (Global.testingServer.db.tests.containsKey(testJson.id))
tests.add(Global.testingServer.db.tests.get(testJson.id));
if (groupsOnly==0) {
for (TestJson testJson : testsJson.array) {
if (Global.testingServer.db.tests.containsKey(testJson.id))
tests.add(Global.testingServer.db.tests.get(testJson.id));
}
}else {
for (Group group: getGroups()){
tests.addAll(Global.testingServer.db.getVectorByFK(group,Test.class));
}
}
return tests;
}
public Vector<Test> getGroupTests(Group group) {
Vector<Test> tests = new Vector<>();
for (TestJson testJson : testsJson.array) {
if (Global.testingServer.db.tests.containsKey(testJson.id)) {
Test test = Global.testingServer.db.tests.get(testJson.id);
if (test.group_id == group.id)
tests.add(test);
if (groupsOnly==0) {
for (TestJson testJson : testsJson.array) {
if (Global.testingServer.db.tests.containsKey(testJson.id)) {
Test test = Global.testingServer.db.tests.get(testJson.id);
if (test.group_id == group.id)
tests.add(test);
}
}
}else {
return Global.testingServer.db.getVectorByFK(group, Test.class);
}
return tests;
}