@@ -3841,6 +3841,7 @@ public function response_analysis($rid, $resps, $compare, $isgroupmember, $allre
3841
3841
$ oppositeallscore = ' | ' .$ allscore [1 ].'% ' ;
3842
3842
}
3843
3843
if ($ this ->survey ->feedbackscores ) {
3844
+ $ table = $ table ?? new html_table ();
3844
3845
if ($ compare ) {
3845
3846
$ table ->data [] = array ($ sectionlabel , $ score [0 ].'% ' .$ oppositescore , $ allscore [0 ].'% ' .$ oppositeallscore );
3846
3847
} else {
@@ -3969,24 +3970,28 @@ public function response_analysis($rid, $resps, $compare, $isgroupmember, $allre
3969
3970
default :
3970
3971
}
3971
3972
3972
- foreach ($ allscore as $ key => $ sc ) {
3973
- if (isset ($ chartlabels [$ key ])) {
3974
- $ lb = explode ("| " , $ chartlabels [$ key ]);
3975
- $ oppositescore = '' ;
3976
- $ oppositeallscore = '' ;
3977
- if (count ($ lb ) > 1 ) {
3978
- $ sectionlabel = $ lb [0 ] . ' | ' . $ lb [1 ];
3979
- $ oppositescore = ' | ' . $ oppositescorepercent [$ key ] . '% ' ;
3980
- $ oppositeallscore = ' | ' . $ alloppositescorepercent [$ key ] . '% ' ;
3981
- } else {
3982
- $ sectionlabel = $ chartlabels [$ key ];
3983
- }
3984
- // If all questions of $section are unseen then don't show feedbackscores for this section.
3985
- if ($ compare && !is_nan ($ scorepercent [$ key ])) {
3986
- $ table ->data [] = array ($ sectionlabel , $ scorepercent [$ key ] . '% ' . $ oppositescore ,
3987
- $ allscorepercent [$ key ] . '% ' . $ oppositeallscore );
3988
- } else if (isset ($ allscorepercent [$ key ]) && !is_nan ($ allscorepercent [$ key ])) {
3989
- $ table ->data [] = array ($ sectionlabel , $ allscorepercent [$ key ] . '% ' . $ oppositeallscore );
3973
+ if ($ this ->survey ->feedbackscores ) {
3974
+ foreach ($ allscore as $ key => $ sc ) {
3975
+ if (isset ($ chartlabels [$ key ])) {
3976
+ $ lb = explode ("| " , $ chartlabels [$ key ]);
3977
+ $ oppositescore = '' ;
3978
+ $ oppositeallscore = '' ;
3979
+ if (count ($ lb ) > 1 ) {
3980
+ $ sectionlabel = $ lb [0 ] . ' | ' . $ lb [1 ];
3981
+ $ oppositescore = ' | ' . $ oppositescorepercent [$ key ] . '% ' ;
3982
+ $ oppositeallscore = ' | ' . $ alloppositescorepercent [$ key ] . '% ' ;
3983
+ } else {
3984
+ $ sectionlabel = $ chartlabels [$ key ];
3985
+ }
3986
+ // If all questions of $section are unseen then don't show feedbackscores for this section.
3987
+ if ($ compare && !is_nan ($ scorepercent [$ key ])) {
3988
+ $ table = $ table ?? new html_table ();
3989
+ $ table ->data [] = array ($ sectionlabel , $ scorepercent [$ key ] . '% ' . $ oppositescore ,
3990
+ $ allscorepercent [$ key ] . '% ' . $ oppositeallscore );
3991
+ } else if (isset ($ allscorepercent [$ key ]) && !is_nan ($ allscorepercent [$ key ])) {
3992
+ $ table = $ table ?? new html_table ();
3993
+ $ table ->data [] = array ($ sectionlabel , $ allscorepercent [$ key ] . '% ' . $ oppositeallscore );
3994
+ }
3990
3995
}
3991
3996
}
3992
3997
}
0 commit comments