Skip to content

Commit 46dba5e

Browse files
committed
Refactoring to use direct array manipulation per Coderabbit suggestion.
1 parent fcf0fba commit 46dba5e

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

components/gong/actions/retrieve-transcripts-of-calls/retrieve-transcripts-of-calls.mjs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,16 @@ export default {
7171
let formattedTranscript = "";
7272

7373
// Process each sentence maintaining chronological order
74-
const allSentences = callTranscript.transcript.reduce((acc, segment) => {
75-
const sentences = segment.sentences.map((sentence) => ({
76-
...sentence,
77-
speakerId: segment.speakerId,
78-
topic: segment.topic,
79-
}));
80-
return [
81-
...acc,
82-
...sentences,
83-
];
84-
}, []);
74+
const allSentences = [];
75+
callTranscript.transcript.forEach((segment) => {
76+
segment.sentences.forEach((sentence) => {
77+
allSentences.push({
78+
...sentence,
79+
speakerId: segment.speakerId,
80+
topic: segment.topic,
81+
});
82+
});
83+
});
8584

8685
// Sort by start time
8786
allSentences.sort((a, b) => a.start - b.start);

0 commit comments

Comments
 (0)