Refactor: Organization Store and Leave Function Updates
Some checks failed
Build / Build (push) Failing after 11s
Some checks failed
Build / Build (push) Failing after 11s
This commit refactors the organization store initialization and the leave function. * **Organization Store:** Changes the way the organization store is initialized by using a declaration array. * **Leave Function:** Improves the leave function by correcting a conditional statement to ensure proper handling of organization keys.
This commit is contained in:
parent
63df0b75dc
commit
cf9bf922f1
@ -14,7 +14,7 @@
|
|||||||
* Organization interface <OBJECT>
|
* Organization interface <OBJECT>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private _orgStoreInterface = createHashMapObject [[
|
private _orgStoreDeclaration = [
|
||||||
["#type", "IOrganizationStore"],
|
["#type", "IOrganizationStore"],
|
||||||
["#create", {
|
["#create", {
|
||||||
private _store = GETMVAR(FORGE_STORE_REG,nil);
|
private _store = GETMVAR(FORGE_STORE_REG,nil);
|
||||||
@ -103,7 +103,7 @@ private _orgStoreInterface = createHashMapObject [[
|
|||||||
private _store = GETMVAR(FORGE_STORE_REG,nil);
|
private _store = GETMVAR(FORGE_STORE_REG,nil);
|
||||||
private _org = _store call ["get", ["organizations", _key]]
|
private _org = _store call ["get", ["organizations", _key]]
|
||||||
|
|
||||||
if (isNil "_org") exitWith { ERROR_MSG_1("Organization with composite key %1 not found", _key); nil };
|
if (isNil "_org") exitWith { ERROR_MSG_1("Organization with composite key %1 not found",_key); nil };
|
||||||
|
|
||||||
_org
|
_org
|
||||||
}],
|
}],
|
||||||
@ -117,7 +117,7 @@ private _orgStoreInterface = createHashMapObject [[
|
|||||||
|
|
||||||
_store call ["delete", ["organizationNameIndex", _key]];
|
_store call ["delete", ["organizationNameIndex", _key]];
|
||||||
|
|
||||||
if (isNil "_key") exitWith { ERROR_MSG_1("Key for organization not found", _key); false };
|
if (isNil "_key") exitWith { ERROR_MSG_1("Key for organization not found",_key); false };
|
||||||
|
|
||||||
_store call ["delete", ["organizations", _key]];
|
_store call ["delete", ["organizations", _key]];
|
||||||
|
|
||||||
@ -128,7 +128,8 @@ private _orgStoreInterface = createHashMapObject [[
|
|||||||
|
|
||||||
true
|
true
|
||||||
}]
|
}]
|
||||||
]];
|
];
|
||||||
|
|
||||||
|
private _orgStoreInterface = createHashMapObject [_orgStoreDeclaration];
|
||||||
SETMVAR(FORGE_ORG_STORE_REG,_orgStoreInterface);
|
SETMVAR(FORGE_ORG_STORE_REG,_orgStoreInterface);
|
||||||
GETMVAR(FORGE_ORG_STORE_REG,nil)
|
GETMVAR(FORGE_ORG_STORE_REG,nil)
|
@ -28,7 +28,7 @@ private _org = _store call ["getByKey", [_key]];
|
|||||||
private _timestamp = systemTimeUTC apply { if (_x < 10) then { "0" + str _x } else { str _x }};
|
private _timestamp = systemTimeUTC apply { if (_x < 10) then { "0" + str _x } else { str _x }};
|
||||||
private _dateTime = format ["%1-%2-%3_%4:%5:%6.%7", _timestamp#0, _timestamp#1, _timestamp#2, _timestamp#3, _timestamp#4, _timestamp#5, _timestamp#6];
|
private _dateTime = format ["%1-%2-%3_%4:%5:%6.%7", _timestamp#0, _timestamp#1, _timestamp#2, _timestamp#3, _timestamp#4, _timestamp#5, _timestamp#6];
|
||||||
|
|
||||||
if (isNil "_org") exitWith { TRACE_1("Organization not found", _key); false };
|
if (isNil "_org") exitWith { TRACE_1("Organization not found",_key); false };
|
||||||
|
|
||||||
private _members = _org get "members";
|
private _members = _org get "members";
|
||||||
private _logs = _org get "logs";
|
private _logs = _org get "logs";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user