@@ -596,7 +596,7 @@ def test_total_average(self):
596
596
597
597
questionnaire = baker .make (Questionnaire , order = 1 , type = Questionnaire .Type .TOP )
598
598
599
- question = baker .make (Question , type = QuestionType .POSITIVE_LIKERT , questionnaire = questionnaire )
599
+ question = baker .make (Question , type = QuestionType .GRADE , questionnaire = questionnaire )
600
600
601
601
evaluation_1 = baker .make (
602
602
Evaluation ,
@@ -610,17 +610,17 @@ def test_total_average(self):
610
610
Evaluation ,
611
611
course__programs = [program ],
612
612
state = Evaluation .State .PUBLISHED ,
613
- _participant_count = 2 ,
614
- _voter_count = 2 ,
613
+ _participant_count = 3 ,
614
+ _voter_count = 3 ,
615
615
)
616
616
617
617
evaluation_1 .general_contribution .questionnaires .set ([questionnaire ])
618
618
619
- make_rating_answer_counters (question , evaluation_1 .general_contribution )
619
+ make_rating_answer_counters (question , evaluation_1 .general_contribution , [ 1 , 1 , 0 , 0 , 0 ] )
620
620
621
621
evaluation_2 .general_contribution .questionnaires .set ([questionnaire ])
622
622
623
- make_rating_answer_counters (question , evaluation_2 .general_contribution )
623
+ make_rating_answer_counters (question , evaluation_2 .general_contribution , [ 1 , 2 , 0 , 0 , 0 ] )
624
624
625
625
cache_results (evaluation_1 )
626
626
cache_results (evaluation_2 )
@@ -642,7 +642,7 @@ def test_total_average(self):
642
642
binary_content .seek (0 )
643
643
workbook = xlrd .open_workbook (file_contents = binary_content .read ())
644
644
645
- self .assertEqual (
645
+ self .assertAlmostEqual (
646
646
float (workbook .sheets ()[0 ].row_values (5 )[1 ]),
647
647
(float (workbook .sheets ()[0 ].row_values (5 )[2 ]) + float (workbook .sheets ()[0 ].row_values (5 )[3 ])) / 2 ,
648
648
)
@@ -707,7 +707,7 @@ def test_not_all_contributions_are_created_equal(self):
707
707
workbook = xlrd .open_workbook (file_contents = binary_content .read ())
708
708
709
709
self .assertEqual (float (workbook .sheets ()[0 ].row_values (8 )[1 ]), float (workbook .sheets ()[0 ].row_values (8 )[3 ]))
710
- self .assertEqual ("" , workbook .sheets ()[0 ].row_values (8 )[2 ])
710
+ self .assertEqual ("" , workbook .sheets ()[0 ].row_values (8 )[2 ]) # testing empty heading for average
711
711
712
712
self .assertEqual (
713
713
workbook .sheets ()[0 ].row_values (0 )[1 ],
0 commit comments