Commit dc6abfd1eb245ce5619f8f10122612ef9e8bf52b
1 parent
31947f9f
Exists in
master
Add a separate field for less interesting logs.
DATABASE BREAK
Showing
1 changed file
with
17 additions
and
3 deletions
Show diff stats
flaskr/models.py
... | ... | @@ -67,10 +67,20 @@ class Estimation(db.Model): |
67 | 67 | |
68 | 68 | # Outputs |
69 | 69 | scenario = db.Column(db.Enum(ScenarioEnum), default=ScenarioEnum.many_to_many) |
70 | - output_yaml = db.Column(db.UnicodeText()) | |
70 | + output_yaml = db.Column(db.UnicodeText()) # deprecated, use shelve file | |
71 | + informations = db.Column(db.UnicodeText()) | |
71 | 72 | warnings = db.Column(db.UnicodeText()) |
72 | 73 | errors = db.Column(db.UnicodeText()) |
73 | 74 | |
75 | + @property | |
76 | + def origins_count(self): | |
77 | + return self.origin_addresses.strip().count("\n") + 1 | |
78 | + | |
79 | + @property | |
80 | + def destinations_count(self): | |
81 | + return self.destination_addresses.strip().count("\n") + 1 | |
82 | + | |
83 | + @property | |
74 | 84 | def has_failed(self): |
75 | 85 | return self.status == StatusEnum.failure |
76 | 86 | |
... | ... | @@ -110,15 +120,19 @@ class Estimation(db.Model): |
110 | 120 | self._output_dict = yaml_load(self.output_yaml) |
111 | 121 | return self._output_dict |
112 | 122 | |
123 | + @property | |
113 | 124 | def is_one_to_one(self): |
114 | 125 | return self.scenario == ScenarioEnum.one_to_one |
115 | 126 | |
127 | + @property | |
116 | 128 | def is_one_to_many(self): |
117 | 129 | return self.scenario == ScenarioEnum.one_to_many |
118 | 130 | |
131 | + @property | |
119 | 132 | def is_many_to_one(self): |
120 | 133 | return self.scenario == ScenarioEnum.many_to_one |
121 | 134 | |
135 | + @property | |
122 | 136 | def is_many_to_many(self): |
123 | 137 | return self.scenario == ScenarioEnum.many_to_many |
124 | 138 | |
... | ... | @@ -141,8 +155,8 @@ class EstimationView(ModelView): |
141 | 155 | 'last_name', |
142 | 156 | 'models_slugs', |
143 | 157 | 'scenario', |
144 | - 'origin_addresses', | |
145 | - 'destination_addresses', | |
158 | + 'origins_count', | |
159 | + 'destinations_count', | |
146 | 160 | 'warnings', |
147 | 161 | 'errors', |
148 | 162 | ) | ... | ... |