Skip to content

Commit

Permalink
fix: missing content for the last paragraph
Browse files Browse the repository at this point in the history
  • Loading branch information
haoming29 committed Sep 14, 2023
1 parent 5acf8c3 commit 495beba
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions frontend/src/pages/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,18 @@ const Home = () => {
}
const result = [];
let buffer = "";
transcription.paragraphs.forEach((para) => {
if (curSpeaker !== para.speaker) {
transcription.paragraphs.forEach((para, idx) => {
if (
curSpeaker !== para.speaker ||
idx === transcription.paragraphs.length - 1
) {
// The first speaker change (-1 to first real speaker number)
// has no content
if (curSpeaker !== -1) {
// change of speaker
let speakerContent = "";
// We have pushed paragraphs into the buffer of
// the current speaker and now we are about to
// change the speaker
let speakerContent = ""; // determine the format of speaker title and name
if (
!speakers[curSpeaker].firstname &&
!speakers[curSpeaker].lastname
Expand All @@ -141,6 +148,7 @@ const Home = () => {
speakerContent += speakers[curSpeaker].lastname;
}
}
// Push formatted content as a new paragraph
const paraElement = (
<p key={uuidv4()}>
<b>{speakerContent}</b>
Expand Down

0 comments on commit 495beba

Please sign in to comment.