fix: use all work reviews for first pass metric
This commit is contained in:
parent
ba0b198eb8
commit
69750d32b4
@ -120,7 +120,7 @@ function FirstPassProjectList({ metric, query, firstPassPage }: Required<Pick<Co
|
|||||||
<div>
|
<div>
|
||||||
<h2 id="first-pass-list-title" className="text-xl font-bold tracking-[-0.02em] sm:text-2xl">所有作品明细</h2>
|
<h2 id="first-pass-list-title" className="text-xl font-bold tracking-[-0.02em] sm:text-2xl">所有作品明细</h2>
|
||||||
<p className="mt-1 text-sm leading-6 text-slate-600">
|
<p className="mt-1 text-sm leading-6 text-slate-600">
|
||||||
展示当前部门范围内全部已上传且包含 V1 的作品;每个作品只取 V1 审核结果,评审中、首轮未通过和待核对状态均会列出。
|
展示作品过稿后台全部已上传且包含 V1 的作品;每个作品只取 V1 审核结果,评审中、首轮未通过和待核对状态均会列出。
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<a
|
<a
|
||||||
|
|||||||
@ -71,7 +71,7 @@ describe('department dashboard first-pass review details', () => {
|
|||||||
}])
|
}])
|
||||||
})
|
})
|
||||||
|
|
||||||
test('summary keeps the full department V1 population while search narrows only detail rows', async () => {
|
test('summary keeps the full brand-center V1 population while search narrows only detail rows', async () => {
|
||||||
const result = await getFirstPassReviewProjects(session, {
|
const result = await getFirstPassReviewProjects(session, {
|
||||||
page: 2,
|
page: 2,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@ -82,24 +82,14 @@ describe('department dashboard first-pass review details', () => {
|
|||||||
by: ['status'],
|
by: ['status'],
|
||||||
where: {
|
where: {
|
||||||
version: 1,
|
version: 1,
|
||||||
project: {
|
project: { is: {} },
|
||||||
is: {
|
|
||||||
submitterEmployee: {
|
|
||||||
is: expect.objectContaining({ OR: expect.any(Array) }),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
_count: { _all: true },
|
_count: { _all: true },
|
||||||
})
|
})
|
||||||
expect(prisma.workReviewProject.count).toHaveBeenCalledWith({
|
expect(prisma.workReviewProject.count).toHaveBeenCalledWith({
|
||||||
where: {
|
where: {
|
||||||
AND: [
|
AND: [
|
||||||
{
|
{},
|
||||||
submitterEmployee: {
|
|
||||||
is: expect.objectContaining({ OR: expect.any(Array) }),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ status: 'approved' },
|
{ status: 'approved' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -108,11 +98,7 @@ describe('department dashboard first-pass review details', () => {
|
|||||||
where: expect.objectContaining({
|
where: expect.objectContaining({
|
||||||
AND: expect.arrayContaining([
|
AND: expect.arrayContaining([
|
||||||
expect.objectContaining({ AND: expect.arrayContaining([
|
expect.objectContaining({ AND: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
{},
|
||||||
submitterEmployee: {
|
|
||||||
is: expect.objectContaining({ OR: expect.any(Array) }),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
{ versions: { some: { version: 1 } } },
|
{ versions: { some: { version: 1 } } },
|
||||||
]) }),
|
]) }),
|
||||||
expect.objectContaining({ OR: expect.any(Array) }),
|
expect.objectContaining({ OR: expect.any(Array) }),
|
||||||
|
|||||||
@ -655,27 +655,31 @@ async function getFirstPassReviewSummaryForProjectWhere(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门看板“首轮通过”的真实统计口径。
|
* 品牌中心看板“首轮通过”的真实统计口径。
|
||||||
*
|
*
|
||||||
* 分子仅包含 V1 状态为 approved 的作品,分母是当前账号明确部门路径范围内
|
* 分子仅包含 V1 状态为 approved 的作品,分母是作品过稿后台当前状态为
|
||||||
* 当前状态为 approved 的全部作品。全部 V1 上传数只用于明细总量展示。
|
* approved 的全部作品。全部 V1 上传数只用于明细总量展示。
|
||||||
*/
|
*/
|
||||||
export async function getFirstPassReviewSummary(
|
export async function getFirstPassReviewSummary(
|
||||||
session: Session | null,
|
session: Session | null,
|
||||||
): Promise<FirstPassReviewSummary> {
|
): Promise<FirstPassReviewSummary> {
|
||||||
const ctx = await getContext(session)
|
// 首轮通过是品牌中心全量作品指标,不按登录人的部门路径缩小分母。
|
||||||
return getFirstPassReviewSummaryForProjectWhere(getDepartmentDashboardProjectWhere(ctx))
|
// getContext 仍负责会话校验和作品过稿通知 worker 的启动,但其部门范围
|
||||||
|
// 只适用于“进行中项目”等部门视图,不适用于这个全量作品指标。
|
||||||
|
await getContext(session)
|
||||||
|
return getFirstPassReviewSummaryForProjectWhere({})
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getFirstPassReviewProjects(
|
export async function getFirstPassReviewProjects(
|
||||||
session: Session | null,
|
session: Session | null,
|
||||||
params?: { page?: number; pageSize?: number; query?: string },
|
params?: { page?: number; pageSize?: number; query?: string },
|
||||||
): Promise<FirstPassReviewProjectPage> {
|
): Promise<FirstPassReviewProjectPage> {
|
||||||
const ctx = await getContext(session)
|
// 明细与卡片使用同一套品牌中心全量作品口径;搜索和分页只缩小明细列表。
|
||||||
|
await getContext(session)
|
||||||
const page = Math.max(1, Number(params?.page || 1) || 1)
|
const page = Math.max(1, Number(params?.page || 1) || 1)
|
||||||
const pageSize = Math.min(50, Math.max(1, Number(params?.pageSize || 20) || 20))
|
const pageSize = Math.min(50, Math.max(1, Number(params?.pageSize || 20) || 20))
|
||||||
const query = clean(params?.query)
|
const query = clean(params?.query)
|
||||||
const scopeWhere = getDepartmentDashboardProjectWhere(ctx)
|
const scopeWhere = {}
|
||||||
const scopeFilters: any[] = [
|
const scopeFilters: any[] = [
|
||||||
scopeWhere,
|
scopeWhere,
|
||||||
{ versions: { some: { version: 1 } } },
|
{ versions: { some: { version: 1 } } },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user