feat(v2.2): 完成高频读取热路径
This commit is contained in:
@@ -77,6 +77,31 @@ export function buildVersionDataScope(input: VersionDataScopeInput): VersionData
|
||||
};
|
||||
}
|
||||
|
||||
export function hasVersionDataScopeRows(scope: VersionDataScope | null | undefined): scope is VersionDataScope {
|
||||
if (!scope) return false;
|
||||
return (
|
||||
scope.requirements.length > 0 ||
|
||||
scope.plans.length > 0 ||
|
||||
scope.devTasks.length > 0 ||
|
||||
scope.testCases.length > 0 ||
|
||||
scope.bugs.length > 0
|
||||
);
|
||||
}
|
||||
|
||||
export function selectVersionDataScope(input: {
|
||||
appDataScope: VersionDataScope | null;
|
||||
v22Scope?: VersionDataScope | null;
|
||||
}): VersionDataScope | null {
|
||||
const { appDataScope, v22Scope } = input;
|
||||
if (hasVersionDataScopeRows(v22Scope)) {
|
||||
return {
|
||||
...v22Scope,
|
||||
overtimeRecords: appDataScope?.overtimeRecords ?? v22Scope.overtimeRecords,
|
||||
};
|
||||
}
|
||||
return appDataScope;
|
||||
}
|
||||
|
||||
export function buildVersionDataScopeMap(input: VersionDataScopeMapInput): Record<string, VersionDataScope> {
|
||||
const scopes: Record<string, VersionDataScope> = {};
|
||||
const targetVersionIds = new Set(input.versionIds);
|
||||
|
||||
Reference in New Issue
Block a user