feat(project): show presign counts as a statistics column
Group presign counts by project and team, include totals and unassigned rows, and reuse count drill-down. Remove the standalone footer while retaining presignTotal compatibility and the four formal business types. Related to issue #13. Independent source review completed; no tests or builds run under user self-test arrangement.
This commit is contained in:
1 parent
ce8babcb7b
commit
79ca01ac0d
5 files changed
+66
-9
No files matched your search
@@ -131,10 +131,11 @@ def records(db, tenant, user, biz_type, page=1, pageSize=20, **filters):
|
||||
def statistics(db, tenant, user, groupBy='project', **filters):
|
||||
if groupBy not in ('project', 'team'):
|
||||
raise HTTPException(400, '分组方式不支持')
|
||||
totals = dict.fromkeys(COUNT_TYPES, 0)
|
||||
unassigned = dict.fromkeys(COUNT_TYPES, 0)
|
||||
statistics_types = ('presign', *COUNT_TYPES)
|
||||
totals = dict.fromkeys(statistics_types, 0)
|
||||
unassigned = dict.fromkeys(statistics_types, 0)
|
||||
counts = {}
|
||||
for kind in COUNT_TYPES:
|
||||
for kind in statistics_types:
|
||||
model = BUSINESS[kind][0]
|
||||
counts[kind] = filtered_query(db, tenant, user, kind, filters).with_entities(
|
||||
model.project_id, func.count(model.id)).group_by(model.project_id).all()
|
||||
@@ -159,10 +160,10 @@ def statistics(db, tenant, user, groupBy='project', **filters):
|
||||
key = team_id if groupBy == 'team' else project_id
|
||||
item = items.setdefault(key, dict(id=key,
|
||||
name=team_name if groupBy == 'team' else (info.project_name if info else None),
|
||||
teamName=team_name, **dict.fromkeys(COUNT_TYPES, 0)))
|
||||
teamName=team_name, **dict.fromkeys(statistics_types, 0)))
|
||||
item[kind] += count
|
||||
return dict(items=list(items.values()), totals=totals, unassignedTotals=unassigned,
|
||||
presignTotal=filtered_query(db, tenant, user, 'presign', filters).count())
|
||||
presignTotal=totals['presign'])
|
||||
|
||||
|
||||
def linked_records(db, tenant, user, kind, row_id, lock=False, current_read=False):
|
||||
|
||||
Reference in new issue
Block a user