Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion apps/api/src/frameworks/frameworks-scores.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
evidenceFormDefinitionList,
meetingSubTypeValues,
toDbEvidenceFormType,
toExternalEvidenceFormType,
} from '@comp/company';
import { db } from '@trycompai/db';
import { filterComplianceMembers } from '../utils/compliance-filters';
Expand Down Expand Up @@ -142,14 +143,27 @@ async function computeDocumentsScore(organizationId: string) {
}

async function getOrganizationFindings(organizationId: string) {
return db.finding.findMany({
const findings = await db.finding.findMany({
where: { organizationId },
include: {
task: { select: { id: true, title: true } },
evidenceSubmission: { select: { id: true, formType: true } },
},
orderBy: [{ status: 'asc' }, { createdAt: 'desc' }],
});

return findings.map((finding) => ({
...finding,
evidenceFormType: toExternalEvidenceFormType(finding.evidenceFormType),
evidenceSubmission: finding.evidenceSubmission
? {
...finding.evidenceSubmission,
formType:
toExternalEvidenceFormType(finding.evidenceSubmission.formType) ??
'meeting',
}
: null,
}));
}

export async function getCurrentMember(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ function FindingsList({
<span className="text-sm font-medium text-foreground line-clamp-1">
{finding.task?.title ??
(finding.evidenceFormType
? `Document: ${finding.evidenceFormType}`
? `Document: ${finding.evidenceFormType.replace(/-/g, ' ')}`
: finding.evidenceSubmission
? `Document: ${finding.evidenceSubmission.formType}`
? `Document: ${finding.evidenceSubmission.formType.replace(/-/g, ' ')}`
: 'Finding')}
</span>
<p className="text-xs text-muted-foreground mt-1 line-clamp-2">
Expand Down
Loading