--- a/OSSEval/analysis/models.py
+++ b/OSSEval/analysis/models.py
@@ -289,7 +289,7 @@
class Question(models.Model):
page = models.ForeignKey(Page)
- text = models.CharField(max_length=200)
+ text = models.CharField(max_length=500)
order = models.IntegerField()
eval_description = models.TextField(null=True,blank=True)
eval_value = models.TextField(null=True,blank=True)
@@ -441,6 +441,10 @@
class Graphs(models.Model):
bar_chart = models.TextField(blank=True)
radar_chart = models.TextField(blank=True)
+ # Graphs are generated for instances of classes that have a "pages" attribute
+ # which is a list of instances of the Class Page
+ # page and methodology_version have pages so this instance of graph has
+ # either a page or methodology_version not null
page = models.ForeignKey(Page,null=True,blank=True)
methodology_version = models.ForeignKey(MethodologyVersion,null=True,blank=True)
weight_scenario = models.ForeignKey(WeightScenario)
@@ -483,7 +487,6 @@
user_login = models.CharField(max_length=50)
visible = models.BooleanField(default=True)
weight_scenario = models.ForeignKey(WeightScenario)
- protected = models.BooleanField(default=False)
def __str__(self):
return self.name
@@ -527,8 +530,11 @@
self.protected = xmlMinidom.getStringAttribute(xmldoc, 'Protected')
#self.weight_scenario
xml_weight_scenario = xmldoc.getElementsByTagName('WeightScenario')[0]
- ws = WeightScenario()
- ws.from_xml(xml_weight_scenario, self.methodology_version, insert)
+ ws = WeightScenario()
+ # while we import an analysis we shall not insert new weight scenarios
+ # weight scenarios should be just a reference to and existing one imported
+ # with the methodology
+ ws.from_xml(xml_weight_scenario, self.methodology_version, False)
self.weight_scenario = ws
self.save()
#Instances
@@ -570,6 +576,8 @@
module = importlib.import_module(self.analysis.methodology_version.methodology.entity.actual_entity_app + ".models")
actual_entity_class = getattr(module, self.analysis.methodology_version.methodology.entity.actual_entity_class)
self.actual_instance = actual_entity_class()
+ # I need to save this instance so that I can save the actual_instance in the following from_xml
+ self.save()
self.actual_instance.from_xml(xml_actual_instance, self, insert)
self.save()
#Answers