Fix a few things

This commit is contained in:
Alexandre Aubin 2018-11-02 01:07:16 +00:00
parent ae195c15a1
commit 6cde7abf67
3 changed files with 35 additions and 8 deletions

View file

@ -112,7 +112,12 @@ class App(db.Model):
.first()
if most_recent_test:
yield most_recent_test
else:
yield AppCIResult(app = self,
branch = branch,
level = None,
date = datetime.datetime.fromtimestamp(0),
results = [ None for t in AppCI.tests ])
class AppCIBranch(db.Model):
@ -156,6 +161,12 @@ class AppCIBranch(db.Model):
.first()
if most_recent_test:
yield most_recent_test
else:
yield AppCIResult(app = app,
branch = self,
level = None,
date = datetime.datetime.fromtimestamp(0),
results = [ None for t in AppCI.tests ])
class AppCIResult(db.Model):
@ -183,7 +194,7 @@ class AppCIResult(db.Model):
def score(self):
s_dict = { True: +1, False: -1, None: 0 }
return sum([ s_dict[result] for result in self.results.values() ])
return sum([ s_dict[result] for result in self.results ])
class AppCI():

View file

@ -40,10 +40,18 @@
</td>
{% endfor %}
<td class="ci-app-test-info">
{% if result.date == None %}
<span class="daysAgo" href="{{ result.url.replace("consoleText", "consoleFull") }}">???</span>
{% if result.url == None %}
{% if result.date == None %}
<span class="daysAgo">???</span>
{% else %}
<span class="daysAgo" timestamp="{{ result.date.timestamp() }}"></span>
{% endif %}
{% else %}
<span class="daysAgo" timestamp="{{ result.date.timestamp() }}" href="{{ result.url.replace("consoleText", "consoleFull") }}"></span>
{% if result.date == None %}
<span class="daysAgo" href="{{ result.url.replace("consoleText", "consoleFull") }}">???</span>
{% else %}
<span class="daysAgo" timestamp="{{ result.date.timestamp() }}" href="{{ result.url.replace("consoleText", "consoleFull") }}"></span>
{% endif %}
{% endif %}
{% if result.commit != result.app.master_commit %}
<span class="oi oi-clock text-warning"

View file

@ -76,10 +76,18 @@
</td>
{% endfor %}
<td class="ci-app-test-info px-0">
{% if result.date == None %}
<span class="daysAgo" href="{{ result.url.replace("consoleText", "consoleFull") }}">???</span>
{% if result.url == None %}
{% if result.date == None %}
<span class="daysAgo">???</span>
{% else %}
<span class="daysAgo" timestamp="{{ result.date.timestamp() }}"></span>
{% endif %}
{% else %}
<span class="daysAgo" timestamp="{{ result.date.timestamp() }}" href="{{ result.url.replace("consoleText", "consoleFull") }}"></span>
{% if result.date == None %}
<span class="daysAgo" href="{{ result.url.replace("consoleText", "consoleFull") }}">???</span>
{% else %}
<span class="daysAgo" timestamp="{{ result.date.timestamp() }}" href="{{ result.url.replace("consoleText", "consoleFull") }}"></span>
{% endif %}
{% endif %}
{% if result.commit != result.app.master_commit %}
<span class="oi oi-clock text-warning"