diff --git a/.gitignore b/.gitignore index ed4a97c..90317be 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /main.db /cache *.pyc +.vscode/ \ No newline at end of file diff --git a/homu/html/queue.html b/homu/html/queue.html index 03c36a4..6b2d16f 100644 --- a/homu/html/queue.html +++ b/homu/html/queue.html @@ -101,6 +101,17 @@ background: #F0DE57; border-color: #8C7E14; } + .riskiness_low { + color: #01CE01; + } + .riskiness_medium { + color: #822a00; + font-weight: 600; + } + .riskiness_high { + color: #de0000; + font-weight: 900; + } .sorting_asc:after { content: " ▲"; } .sorting_desc:after { content: " ▼"; } @@ -136,6 +147,7 @@

Homu queue - {% if repo_url %}{{repo_

This will create a new pull request consisting of 0 PRs.

+

Based on the number of PRs and their rollup statuses, this rollup is considered not risky.

A rollup is useful for shortening the queue, but jumping the queue is unfair to older PRs who have waited too long.

When creating a real rollup, see this instruction for reference.

@@ -222,9 +234,38 @@

Homu queue - {% if repo_url %}{{repo_ ]; document.getElementById('expand-rollup').onclick = function() { - var checkboxCount = document.querySelectorAll('#queue tbody input[type=checkbox]:checked').length; + var els = document.querySelectorAll('#queue tbody input[type=checkbox]:checked'); + var checkboxCount = els.length; document.getElementById('checkbox-count').innerHTML = checkboxCount; document.getElementById('actual-rollup').className = ''; + + var value = 0; + for (var i = 0; i < els.length; i++) { + var rollupClassName = els[i].parentNode.parentNode.children[10].className; + if (rollupClassName === "rollup_always") { + } else if (rollupClassName === "rollup_iffy") { + value += 2; + } else { // nothing or "rollup_maybe" + value += 1; + } + } + value = (value / 8) + (Math.max((checkboxCount - 8), 0) / 8); + + var riskiness = 'not risky'; + var riskinessClass = 'riskiness_low'; + if (value > 0 && value <= 0.5) { + riskiness = 'acceptably risky'; + } else if (value <= 1.0) { + riskiness = 'somewhat risky'; + } else if (value <= 2.0) { + riskinessClass = 'riskiness_medium'; + riskiness = 'risky'; + } else if (value > 2.0) { + riskinessClass = 'riskiness_high'; + riskiness = '⚠️very risky⚠️'; + } + document.getElementById('riskiness').innerHTML = riskiness; + document.getElementById('riskiness').className = riskinessClass; }; document.getElementById('cancel-rollup').onclick = function() {