Misc adaptation for new level 9

This commit is contained in:
Alexandre Aubin 2020-12-30 22:34:48 +00:00
parent b08871b435
commit 620ff4b033
4 changed files with 9 additions and 7 deletions

View file

@ -136,7 +136,7 @@ def badge(app):
badge = "level%s.svg" % level if not level is None else "unknown.svg" badge = "level%s.svg" % level if not level is None else "unknown.svg"
if not app.ci_enabled: if app.state != "working":
badge = "unknown.svg" badge = "unknown.svg"
svg = open("./app/static/badges/%s" % badge).read() svg = open("./app/static/badges/%s" % badge).read()

View file

@ -92,7 +92,7 @@ def make_count_summary():
for state in states: for state in states:
summary[state] = len([k for k, infos in j.items() if infos["state"] == state]) summary[state] = len([k for k, infos in j.items() if infos["state"] == state])
for level in range(0, 9): for level in range(0, 10):
summary["level-%s" % level] = len([k for k, infos in j.items() summary["level-%s" % level] = len([k for k, infos in j.items()
if infos["state"] in ["working", "official"] if infos["state"] in ["working", "official"]
and infos.get("level", None) == level]) and infos.get("level", None) == level])
@ -138,7 +138,7 @@ def update_catalog_stats(app, history):
except: except:
return return
app_in_db.long_term_good_quality = len([d for d in history[-24:] if d["level"] > 5]) > 12 app_in_db.long_term_good_quality = len([d for d in history[-24:] if d["level"] > 5]) > 0.90 * 24
app_in_db.long_term_broken = history[-1]["level"] == 0 and len([d for d in history[-24:] if d["level"] == 0]) > 12 app_in_db.long_term_broken = history[-1]["level"] == 0 and len([d for d in history[-24:] if d["level"] == 0]) > 12
db.session.add(app_in_db) db.session.add(app_in_db)

View file

@ -24,7 +24,7 @@
</thead> </thead>
<tbody> <tbody>
{% for result in app_results %} {% for result in app_results %}
<tr app="{{ result.app.name }}" class="resultline {% if result.needs_attention %}ci-needs-attention{% endif %}" {% if result.outdated %}style="opacity: 0.8; background-color: #ddd;"{% endif %} > <tr app="{{ result.app.name }}" class="resultline {% if result.needs_attention %}ci-needs-attention{% endif %}" {% if result.outdated %}style="opacity: 0.8; background-color: #e9e9e9;"{% endif %} >
<td class="ci-app-row-title"> <td class="ci-app-row-title">
{% if result.app.long_term_good_quality %} {% if result.app.long_term_good_quality %}
<span class="oi oi-star" title="Long-term good quality" aria-hidden="true" style="color: goldenrod;"></span> <span class="oi oi-star" title="Long-term good quality" aria-hidden="true" style="color: goldenrod;"></span>
@ -106,7 +106,8 @@ window.onload = function () {
{ y: $(".ci-app-level[value=5]").length, label: "Level 5", color: "#A6B255" }, { y: $(".ci-app-level[value=5]").length, label: "Level 5", color: "#A6B255" },
{ y: $(".ci-app-level[value=6]").length, label: "Level 6", color: "#7AB659" }, { y: $(".ci-app-level[value=6]").length, label: "Level 6", color: "#7AB659" },
{ y: $(".ci-app-level[value=7]").length, label: "Level 7", color: "#5cb85c" }, { y: $(".ci-app-level[value=7]").length, label: "Level 7", color: "#5cb85c" },
{ y: $(".ci-app-level[value=8]").length, label: "Level 8", color: "#4695d5" } { y: $(".ci-app-level[value=8]").length, label: "Level 8", color: "#4695d5" },
{ y: $(".ci-app-level[value=9]").length, label: "Level 9", color: "#8960b3" }
] ]
}] }]
}); });

View file

@ -17,7 +17,8 @@ window.onload = function () {
"#A6B255", "#A6B255",
"#7AB659", "#7AB659",
"#5cb85c", "#5cb85c",
"#4695d5" "#4695d5",
"#8960b3"
]; ];
var colors_per_state = { var colors_per_state = {
@ -37,7 +38,7 @@ window.onload = function () {
shared: true shared: true
}, },
data: [ data: [
{% for level in range(8,-1,-1) %} {% for level in range(9,-1,-1) %}
{ {
color: colors_per_level[{{ level }}], color: colors_per_level[{{ level }}],
type: "stackedArea", type: "stackedArea",