From 180e775d4a0bbfa211410727ddd13553f30ecf97 Mon Sep 17 00:00:00 2001
From: alyssaf16 <alyssa_feinberg@brown.edu>
Date: Wed, 4 Sep 2024 22:40:19 -0400
Subject: fix bug

---
 src/client/views/nodes/ComparisonBox.tsx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src/client/views/nodes/ComparisonBox.tsx')

diff --git a/src/client/views/nodes/ComparisonBox.tsx b/src/client/views/nodes/ComparisonBox.tsx
index 9e1c1b7be..2d4bba8d1 100644
--- a/src/client/views/nodes/ComparisonBox.tsx
+++ b/src/client/views/nodes/ComparisonBox.tsx
@@ -169,8 +169,7 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent<FieldViewProps>()
     };
 
     @action handleRenderGPTClick = async () => {
-        console.log('Phonetic transcription: ' + DocCast(this.Document.audio).phoneticTranscription);
-        const phonTrans = DocCast(this.Document.audio).phoneticTranscription;
+        const phonTrans = DocCast(this.Document.audio) ? DocCast(this.Document.audio).phoneticTranscription : undefined;
         if (phonTrans) {
             this._inputValue = StrCast(phonTrans);
             console.log('INPUT:' + this._inputValue);
@@ -471,6 +470,7 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent<FieldViewProps>()
                 DocCast(this.dataDoc[this.props.fieldKey + '_0'])[DocData].text = res;
             } else if (callType == GPTCallType.QUIZ) {
                 console.log(this._inputValue);
+                this.frontSide = true;
                 this._outputValue = res.replace(/UserAnswer/g, "user's answer").replace(/Rubric/g, 'rubric');
             } else if (callType === GPTCallType.FLASHCARD) {
                 this._loading = false;
@@ -614,7 +614,7 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent<FieldViewProps>()
     };
 
     hoverFlip = (side: boolean) => {
-        if (this.revealOp === 'hover') this.layoutDoc[`_${this._props.fieldKey}_usePath`] = side;
+        if (this.revealOp === 'hover') this.frontSide = side;
     };
 
     testForTextFields = (whichSlot: string) => {
@@ -775,7 +775,7 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent<FieldViewProps>()
                                     Evaluate Pronunciation
                                 </button>
 
-                                {this.frontSide ? (
+                                {!this.frontSide ? (
                                     <button className="submit-buttonsubmit" type="button" onClick={this.handleRenderGPTClick} style={{ borderRadius: '2px', marginBottom: '3px', width: '100%' }}>
                                         Submit
                                     </button>
-- 
cgit v1.2.3-70-g09d2

