mirror of
https://github.com/YunoHost/tartiflette.git
synced 2024-09-03 20:06:08 +02:00
Fix display of test results
This commit is contained in:
parent
093e61f136
commit
4388c05fa8
2 changed files with 8 additions and 7 deletions
|
@ -52,7 +52,7 @@ class AppCIBranch(db.Model):
|
||||||
branch = self,
|
branch = self,
|
||||||
level = None,
|
level = None,
|
||||||
date = datetime.datetime.fromtimestamp(0),
|
date = datetime.datetime.fromtimestamp(0),
|
||||||
results = [ None for t in AppCI.tests ])
|
results = { t:None for t in AppCI.tests })
|
||||||
|
|
||||||
|
|
||||||
class AppCIResult(db.Model):
|
class AppCIResult(db.Model):
|
||||||
|
@ -80,7 +80,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 ])
|
return sum([ s_dict[result] for result in self.results.values() ])
|
||||||
|
|
||||||
|
|
||||||
class AppCI():
|
class AppCI():
|
||||||
|
@ -106,9 +106,6 @@ class AppCI():
|
||||||
|
|
||||||
cibranches = AppCIBranch.query.all()
|
cibranches = AppCIBranch.query.all()
|
||||||
|
|
||||||
def symbol_to_bool(s):
|
|
||||||
return bool(int(s)) if s in [ "1", "0" ] else None
|
|
||||||
|
|
||||||
# Scrap jenkins
|
# Scrap jenkins
|
||||||
for cibranch in cibranches:
|
for cibranch in cibranches:
|
||||||
print("> Fetching current CI results for C.I. branch {}".format(cibranch.name))
|
print("> Fetching current CI results for C.I. branch {}".format(cibranch.name))
|
||||||
|
@ -121,11 +118,15 @@ class AppCI():
|
||||||
if (test_summary["arch"], test_summary["branch"]) != (cibranch.arch, cibranch.branch):
|
if (test_summary["arch"], test_summary["branch"]) != (cibranch.arch, cibranch.branch):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
test_results = { }
|
||||||
|
for test, result in zip(AppCI.tests, test_summary["detailled_success"]):
|
||||||
|
test_results[test] = bool(int(result)) if result in [ "1", "0" ] else None
|
||||||
|
|
||||||
results = AppCIResult(app = App.query.filter_by(name=test_summary["app"]).first(),
|
results = AppCIResult(app = App.query.filter_by(name=test_summary["app"]).first(),
|
||||||
branch = cibranch,
|
branch = cibranch,
|
||||||
level = test_summary["level"],
|
level = test_summary["level"],
|
||||||
date = datetime.datetime.fromtimestamp(test_summary["timestamp"]),
|
date = datetime.datetime.fromtimestamp(test_summary["timestamp"]),
|
||||||
results = [ symbol_to_bool(s) for s in test_summary["detailled_success"] ])
|
results = test_results)
|
||||||
db.session.add(results)
|
db.session.add(results)
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
|
@ -148,7 +148,7 @@ class App(db.Model):
|
||||||
branch = branch,
|
branch = branch,
|
||||||
level = None,
|
level = None,
|
||||||
date = datetime.datetime.fromtimestamp(0),
|
date = datetime.datetime.fromtimestamp(0),
|
||||||
results = [ None for t in AppCI.tests ])
|
results = { t:None for t in AppCI.tests })
|
||||||
|
|
||||||
class Github():
|
class Github():
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue