@@ -9,25 +9,28 @@ class Tutor extends Backbone.Controller {
99  initialize ( )  { 
1010    this . listenTo ( Adapt ,  { 
1111      'componentView:postRender' : this . onComponentViewPostRender , 
12-       'questionView:showFeedback' : this . onQuestionViewShowFeedback 
12+       'questionView:showFeedback' : this . onQuestionViewShowFeedback , 
13+       'buttonsView:postRender' : this . onButtonsViewPostRender 
1314    } ) ; 
1415  } 
1516
1617  onComponentViewPostRender ( view )  { 
17-     const  model  =  view . model ; 
18+     const  {   model }   =  view ; 
1819    if  ( ! model . isTypeGroup ( 'question' ) )  return ; 
19-     const  config  =  model . get ( '_tutor' ) ; 
20-     if  ( ! config )  return ; 
21-     const  type  =  TUTOR_TYPE ( config . _type ?. toUpperCase ( ) ) ; 
22-     if  ( type  !==  TUTOR_TYPE . INLINE )  return ; 
23-     this . listenToOnce ( Adapt ,  'buttonsView:postRender' ,  this . onButtonsViewPostRender ) ; 
24-     if  ( model . get ( '_canShowFeedback' )  &&  model . get ( '_isSubmitted' ) )  { 
25-       model . setupFeedback ( ) ; 
26-       Adapt . trigger ( 'questionView:showFeedback' ,  view ) ; 
27-     } 
20+     const  shouldShowFeedback  =  ( model . get ( '_canShowFeedback' )  &&  model . get ( '_isSubmitted' ) ) ; 
21+     if  ( ! shouldShowFeedback )  return ; 
22+     model . setupFeedback ( ) ; 
23+     Adapt . trigger ( 'questionView:showFeedback' ,  view ) ; 
2824  } 
2925
3026  onButtonsViewPostRender ( view )  { 
27+     const  {  model }  =  view ; 
28+     const  config  =  ( ! model . get ( '_tutor' )  ||  ( model . get ( '_tutor' ) ?. _isInherited  ??  true ) ) 
29+       ? Adapt . course . get ( '_tutor' ) 
30+       : model . get ( '_tutor' ) ; 
31+     if  ( ! config )  return ; 
32+     const  type  =  TUTOR_TYPE ( config . _type ?. toUpperCase ( ) ) ; 
33+     if  ( type  !==  TUTOR_TYPE . INLINE )  return ; 
3134    const  $btnAction  =  view . $ ( '.js-btn-action' ) ; 
3235    const  $btnFeedback  =  view . $ ( '.js-btn-feedback' ) ; 
3336    const  $btnMarking  =  view . $ ( '.js-btn-marking' ) ; 
0 commit comments