The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Estimate a Teams history import from the pages that can import a transcript (#27997)
nitin4ddcef5255eb
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/front-components/utils/__tests__/get-teams-transcript-history-view.test.ts b/packages/twenty-apps/public/teams/src/features/transcripts/front-components/utils/__tests__/get-teams-transcript-history-view.test.tsindex 578bd08365b..433811240ba 100644--- a/packages/twenty-apps/public/teams/src/features/transcripts/front-components/utils/__tests__/get-teams-transcript-history-view.test.ts+++ b/packages/twenty-apps/public/teams/src/features/transcripts/front-components/utils/__tests__/get-teams-transcript-history-view.test.ts@@ -67,18 +67,46 @@ describe('getTeamsTranscriptHistoryView', () => {});expect(getTeamsTranscriptHistoryView({- state: { ...STATE, phase: 'counted', pageCount: 59 },+ state: {+ ...STATE,+ phase: 'counted',+ transcriptCount: 100,+ pageCount: 59,+ },isStalled: false,}),).toMatchObject({ importEstimate: { unit: 'minute', count: 59 } });expect(getTeamsTranscriptHistoryView({- state: { ...STATE, phase: 'counted', pageCount: 61 },+ state: {+ ...STATE,+ phase: 'counted',+ transcriptCount: 100,+ pageCount: 61,+ },isStalled: false,}),).toMatchObject({ importEstimate: { unit: 'hour', count: 2 } });});+ it('should only count the pages that can import a transcript in the estimate', () => {+ expect(+ getTeamsTranscriptHistoryView({+ state: {+ ...STATE,+ phase: 'counted',+ transcriptCount: 12,+ alreadyImportedCount: 7,+ pageCount: 40,+ },+ isStalled: false,+ }),+ ).toMatchObject({+ toImportCount: 5,+ importEstimate: { unit: 'minute', count: 5 },+ });+ });+it('should report the count progress while counting', () => {expect(getTeamsTranscriptHistoryView({diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/front-components/utils/get-teams-transcript-history-view.ts b/packages/twenty-apps/public/teams/src/features/transcripts/front-components/utils/get-teams-transcript-history-view.tsindex 243c3f318c7..173ae668eb9 100644--- a/packages/twenty-apps/public/teams/src/features/transcripts/front-components/utils/get-teams-transcript-history-view.ts+++ b/packages/twenty-apps/public/teams/src/features/transcripts/front-components/utils/get-teams-transcript-history-view.ts@@ -53,7 +53,9 @@ export const getTeamsTranscriptHistoryView = ({alreadyImportedCount: state.alreadyImportedCount,deletedCount: state.deletedCount,toImportCount,- importEstimate: getImportEstimate(state.pageCount),+ importEstimate: getImportEstimate(+ Math.min(state.pageCount, toImportCount),+ ),};case 'importing':case 'imported':