优化:产品查询数据库分页并修复报告测试契约
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { splitMetricsLoad } from './priorityMetrics.ts';
|
||||
import type { QueryParams } from './types';
|
||||
|
||||
export type ProductOrder = 'brightQualifiedDesc' | 'blackTotalDesc' | 'brightTotalDesc' | 'productAsc';
|
||||
export const PRODUCT_PAGE_SIZE = 15;
|
||||
|
||||
/** 已限定产品的少量结果保留原路径;宽产品表按数据库页读取。 */
|
||||
export function shouldPageProducts(query: QueryParams): boolean {
|
||||
return query.view === 'product' && !!query.releaseId && !query.product;
|
||||
}
|
||||
|
||||
export function pageSelection(scope: string, selected: { scope: string; page: number; size: number }) {
|
||||
return { page: selected.scope === scope ? selected.page : 1, size: selected.size };
|
||||
}
|
||||
|
||||
/** 宽年度先显示摘要;月/季/搜索并行读取小页,避免窄筛选多一次串行等待。 */
|
||||
export function canReadProductPage(query: QueryParams, overviewSettled: boolean): boolean {
|
||||
return overviewSettled || !splitMetricsLoad(query);
|
||||
}
|
||||
Reference in New Issue
Block a user