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() .first()
if most_recent_test: if most_recent_test:
yield 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): class AppCIBranch(db.Model):
@ -156,6 +161,12 @@ class AppCIBranch(db.Model):
.first() .first()
if most_recent_test: if most_recent_test:
yield 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): class AppCIResult(db.Model):
@ -183,7 +194,7 @@ class AppCIResult(db.Model):
def score(self): def score(self):
s_dict = { True: +1, False: -1, None: 0 } 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(): class AppCI():

View file

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

View file

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