Промежуточный. Убрал рудимент связанный с хранением ключей задач. Настроил синхронизацию сапфоровских пакетов.

This commit is contained in:
2023-10-12 21:48:22 +03:00
parent d5ff1683cb
commit 6d7367894f
12 changed files with 59 additions and 94 deletions

View File

@@ -3,6 +3,7 @@ import Common.Current;
import Common.UI.UI;
import Repository.Server.ServerCode;
import Repository.Server.ServerExchangeUnit_2021;
import SapforTestingSystem.SapforTasksPackage.SapforTasksPackage;
import TestingSystem.TasksPackage.TasksPackage;
import TestingSystem.TasksPackage.TasksPackageState;
import TestingSystem.TestingServer;
@@ -11,20 +12,31 @@ import Visual_DVM_2021.Passes.TestingSystemPass;
import javafx.util.Pair;
import java.util.Vector;
public class ActualizePackages extends TestingSystemPass<Vector<TasksPackage>> {
public class ActualizePackages extends TestingSystemPass<Object> {
boolean needsSynchronize;
Vector<TasksPackage> dvmPackages;
Vector<SapforTasksPackage> spfPackages;
@Override
protected void ServerAction() throws Exception {
Vector<TasksPackage> actual_packages = new Vector<>();
for (TasksPackage p : target) {
for (TasksPackage p : dvmPackages) {
TasksPackageState oldState = p.state;
Command(new ServerExchangeUnit_2021(ServerCode.GetAccountObjectCopyByPK, Current.getAccount().email, new Pair<>(TasksPackage.class, p.id)));
TasksPackage actual_package = (TasksPackage) response.object;
actual_packages.add(actual_package);
//-
p.SynchronizeFields(actual_package);
if (!oldState.equals(p.state) && p.state.equals(TasksPackageState.Done))
needsSynchronize=true; //состояние изменилось, и на Done значит нужно скачивать задачи.
needsSynchronize = true; //состояние изменилось, и на Done значит нужно скачивать задачи.
server.account_db.Update(p);
}
//---
for (SapforTasksPackage p : spfPackages) {
TasksPackageState oldState = p.state;
Command(new ServerExchangeUnit_2021(ServerCode.GetAccountObjectCopyByPK, Current.getAccount().email, new Pair<>(SapforTasksPackage.class, p.id)));
SapforTasksPackage actual_package = (SapforTasksPackage) response.object;
//-
p.SynchronizeFields(actual_package);
if (!oldState.equals(p.state) && p.state.equals(TasksPackageState.Done))
needsSynchronize = true; //состояние изменилось, и на Done значит нужно скачивать задачи.
server.account_db.Update(p);
}
}
@@ -34,9 +46,10 @@ public class ActualizePackages extends TestingSystemPass<Vector<TasksPackage>> {
}
@Override
protected boolean canStart(Object... args) throws Exception {
needsSynchronize=false;
target = server.account_db.getActivePackages();
return !target.isEmpty();
needsSynchronize = false;
dvmPackages = server.account_db.getActivePackages();
spfPackages = server.account_db.getActiveSapforPackages();
return !dvmPackages.isEmpty() || !spfPackages.isEmpty();
}
@Override
protected void performCanNotStart() throws Exception {
@@ -53,18 +66,20 @@ public class ActualizePackages extends TestingSystemPass<Vector<TasksPackage>> {
@Override
protected void showPreparation() throws Exception {
server.account_db.packages.ClearUI();
server.account_db.sapforTasksPackages.ClearUI();
}
@Override
protected void showDone() throws Exception {
server.account_db.packages.ShowUI();
server.account_db.sapforTasksPackages.ShowUI();
//--->>
if (!TestingServer.checkTasks) UI.getMainWindow().getTestingWindow().ShowAutoActualizeTestsState();
server.account_db.RestoreLastSelections();
}
@Override
protected void performDone() throws Exception {
super.performDone();
if (needsSynchronize) {
if (needsSynchronize)
passes.get(PassCode_2021.SynchronizeTestsTasks).Do();
}
}
}