Switch to side-by-side view

--- a/OSSEval/analysis/models.py
+++ b/OSSEval/analysis/models.py
@@ -68,9 +68,9 @@
                     instance_scores[instance.id].append(ps.score)
                 except:
                     instance_scores[instance.id].append(0)
-                if include_max:
-                    instance_scores[0].append(5)
-                    print str(page.id) + " - " + str(page.max_score)
+            if include_max:
+                instance_scores[0].append(page.max_score_weighted)
+                print page.name + " - " + str(page.max_score_weighted)
         for instance in instances:
             radar_chart.add(instance.name, instance_scores[instance.id])
             bar_chart.add(instance.name, sum(instance_scores[instance.id]))
@@ -138,7 +138,8 @@
     order = models.IntegerField(null=False,blank=False)
     parent = models.ForeignKey('self',null=True,blank=True)
     methodology_version = models.ForeignKey(MethodologyVersion,null=True,blank=True)
-    max_score = 0
+    max_score_weighted = models.IntegerField(null=False,blank=False,default=0)
+    
     def questions(self):
         q = list(self.question_set.all())
         for p in self.page_set.all():
@@ -191,7 +192,7 @@
         return '<Page Id="' + str(self.id) + '" Name="' + self.name + '" Order="' + str(self.order) + '">' + str_xml + "</Page>"
 
     def calculate_scores(self, instance, weight_scenario, instances):
-        self.max_score = 5
+        self.max_score_weighted = 0
 #         Let's reset the score to 0
         try:
             ps = PageScore.objects.get(page=self, instance=instance)
@@ -201,9 +202,11 @@
 #         and calculate the score for child pages and add it to current page's score
         for page in self.page_set.all():
             ps.score += page.calculate_scores(instance, weight_scenario, instances)
+            self.max_score_weighted += page.max_score_weighted
 #         Loop on questions
-        for question in self.questions():
+        for question in self.question_set.all():
             weight = weight_scenario.question_weight(question.id)
+            self.max_score_weighted += question.max_score() * weight
             try:
                 answer = Answer.objects.get(question=question, instance=instance)
                 answer.score = weight * (answer.value_integer-1) 
@@ -211,8 +214,8 @@
                 ps.score += answer.score
             except Exception as ex:
                 #I haven't found an answer, nothing to add
-                print ex.message
                 pass
+        self.save()
         ps.save()
         self.create_graphs(instances)
         return ps.score
@@ -282,6 +285,13 @@
             str_xml += choice.to_xml()
         str_xml += "</Choices>"
         return '<Question Id="' + str(self.id) + '" Text="' + self.text + '" Order="' + str(self.order) + '">' + str_xml + '</Question>'
+
+    def max_score(self):
+        max_score = 0
+        for choice in self.choice_set.all():
+            if choice.order-1 > max_score:
+                max_score = choice.order-1
+        return max_score
 
     class Meta:
         ordering = ['order']
@@ -578,9 +588,6 @@
     class Meta:
         unique_together = ('question', 'instance',)
 
-class Configuration(models.Model):
-    default_methodology_version = models.ForeignKey(MethodologyVersion, blank=True, null=True)
-
 
 class UploadedFile(models.Model):
     '''