feat: Refactor CAD store payload handling by removing unused buildSeedHydratePayload function
This commit is contained in:
parent
54c5b415e4
commit
516c6e725e
@ -294,38 +294,6 @@ GVAR(CadStoreBaseClass) = compileFinal createHashMapFromArray [
|
|||||||
_self call ["emitGroupEvent", ["cad.group.updated", _result]];
|
_self call ["emitGroupEvent", ["cad.group.updated", _result]];
|
||||||
_result
|
_result
|
||||||
}],
|
}],
|
||||||
["buildSeedHydratePayload", compileFinal {
|
|
||||||
params [["_seed", createHashMap, [createHashMap]]];
|
|
||||||
|
|
||||||
private _session = _seed getOrDefault ["session", createHashMap];
|
|
||||||
private _isDispatcher = _session getOrDefault ["isDispatcher", false];
|
|
||||||
private _contracts = [];
|
|
||||||
|
|
||||||
if (_isDispatcher) then {
|
|
||||||
{
|
|
||||||
if !(_x isEqualType createHashMap) then { continue; };
|
|
||||||
|
|
||||||
private _entry = +_x;
|
|
||||||
private _taskID = _entry getOrDefault ["taskId", _entry getOrDefault ["taskID", ""]];
|
|
||||||
if (_taskID isEqualTo "") then { continue; };
|
|
||||||
|
|
||||||
_entry set ["taskId", _taskID];
|
|
||||||
_entry set ["taskID", _taskID];
|
|
||||||
_entry set ["assignedGroupId", ""];
|
|
||||||
_entry set ["assignmentState", "unassigned"];
|
|
||||||
_contracts pushBack _entry;
|
|
||||||
} forEach (_seed getOrDefault ["activeTasks", []]);
|
|
||||||
};
|
|
||||||
|
|
||||||
createHashMapFromArray [
|
|
||||||
["groups", _seed getOrDefault ["groups", []]],
|
|
||||||
["contracts", _contracts],
|
|
||||||
["requests", []],
|
|
||||||
["assignments", []],
|
|
||||||
["activity", []],
|
|
||||||
["session", _session]
|
|
||||||
]
|
|
||||||
}],
|
|
||||||
["buildHydratePayload", compileFinal {
|
["buildHydratePayload", compileFinal {
|
||||||
params [["_uid", "", [""]]];
|
params [["_uid", "", [""]]];
|
||||||
|
|
||||||
@ -345,12 +313,19 @@ GVAR(CadStoreBaseClass) = compileFinal createHashMapFromArray [
|
|||||||
["activeTasks", EGVAR(task,TaskStore) call ["getActiveTaskCatalog", []]],
|
["activeTasks", EGVAR(task,TaskStore) call ["getActiveTaskCatalog", []]],
|
||||||
["session", _session]
|
["session", _session]
|
||||||
];
|
];
|
||||||
private _seedPayload = _self call ["buildSeedHydratePayload", [_seed]];
|
private _emptyPayload = createHashMapFromArray [
|
||||||
|
["groups", _seed get "groups"],
|
||||||
|
["contracts", []],
|
||||||
|
["requests", []],
|
||||||
|
["assignments", []],
|
||||||
|
["activity", []],
|
||||||
|
["session", _session]
|
||||||
|
];
|
||||||
private _persistenceService = _self getOrDefault ["PersistenceService", createHashMap];
|
private _persistenceService = _self getOrDefault ["PersistenceService", createHashMap];
|
||||||
|
|
||||||
if (_persistenceService isEqualTo createHashMap) exitWith {
|
if (_persistenceService isEqualTo createHashMap) exitWith {
|
||||||
["WARNING", "CAD hydrate extension state is unavailable; returning seed-only payload."] call EFUNC(common,log);
|
["WARNING", "CAD hydrate extension state is unavailable; returning seed-only payload."] call EFUNC(common,log);
|
||||||
_seedPayload
|
_emptyPayload
|
||||||
};
|
};
|
||||||
|
|
||||||
private _hydrateResult = _persistenceService call ["buildHydratePayload", [_seed]];
|
private _hydrateResult = _persistenceService call ["buildHydratePayload", [_seed]];
|
||||||
@ -359,7 +334,7 @@ GVAR(CadStoreBaseClass) = compileFinal createHashMapFromArray [
|
|||||||
};
|
};
|
||||||
|
|
||||||
["WARNING", "CAD hydrate failed in the extension; returning seed-only payload."] call EFUNC(common,log);
|
["WARNING", "CAD hydrate failed in the extension; returning seed-only payload."] call EFUNC(common,log);
|
||||||
_seedPayload
|
_emptyPayload
|
||||||
}]
|
}]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user