Skip to content

Commit

Permalink
chore: improve the temperature colors
Browse files Browse the repository at this point in the history
Signed-off-by: Jaime Silvela <[email protected]>
  • Loading branch information
jsilvela committed Jun 6, 2024
1 parent 66591bc commit 882de21
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions summarize_test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,20 +589,29 @@ def compute_semaphore(success_percent, embed=True):
If set to `embed`, an emoji will be used. Else, a textual representation
of a Slack emoji is used.
"""
if embed:
if success_percent >= 95:
return "🟢"
elif success_percent >= 60:
return "🟡"
else:
return "🔴"
levels = {
"good": {
"emoji": "🟢",
"text": ":large_green_circle:",
},
"average": {
"emoji": "🟡",
"text": ":large_yellow_circle:",
},
"bad": {
"emoji": "🔴",
"text": ":red_circle:",
},
}
form = "emoji"
if not embed:
form = "text"
if success_percent >= 99:
return levels["good"][form]
elif success_percent >= 95:
return levels["average"][form]
else:
if success_percent >= 95:
return ":large_green_circle:"
elif success_percent >= 60:
return ":large_yellow_circle:"
else:
return ":red_circle:"
return levels["bad"][form]


def compute_thermometer_on_metric(summary, metric, embed=True):
Expand Down

0 comments on commit 882de21

Please sign in to comment.