added filter to decide what challenges to include

This commit is contained in:
2026-11-05 15:42:52 +01:00
parent 4fac6ed86d
commit 09849d0ef6
11 changed files with 214 additions and 28 deletions
+22 -7
View File
@@ -3,17 +3,21 @@ from __future__ import annotations
from collections import defaultdict
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass
from dataclasses import dataclass, field
from .challenge import CATEGORIES, DIFFICULTIES, STATUS_ORDER, Challenge, difficulty_rank, parse_challenge
from .checks import is_testable, readme_problems, repo_blockers
from .gitlab import GitLab
from .selection import Selection
@dataclass
class Overview:
challenges: list # repos with a README somebody filled in
blank: list # repos with no README, or an untouched template
challenges: list # included repos with a README somebody filled in
blank: list # included repos with no README, or an untouched template
excluded: list = field(default_factory=list) # abandoned or postponed in challenges.yml
undecided: list = field(default_factory=list) # repos not in challenges.yml
unknown: list = field(default_factory=list) # repo paths in challenges.yml that do not exist
@property
def categories(self) -> list[str]:
@@ -56,11 +60,19 @@ class Overview:
return out
def collect(gl: GitLab) -> Overview:
chs, blank = [], []
def collect(gl: GitLab, sel: Selection) -> Overview:
chs, blank, excluded, undecided, seen = [], [], [], [], set()
for repo in gl.repos():
seen.add(repo.path)
c = parse_challenge(repo)
(chs if c.touched else blank).append(c)
c.selection = sel.states.get(repo.path)
c.skip_checks = sel.skip_checks.get(repo.path, [])
if not c.selection:
undecided.append(c)
elif not c.included:
excluded.append(c)
else:
(chs if c.touched else blank).append(c)
for c in chs:
c.problems = readme_problems(c)
@@ -71,7 +83,10 @@ def collect(gl: GitLab) -> Overview:
with ThreadPoolExecutor(max_workers=8) as pool:
list(pool.map(check, [c for c in chs if c.claims_testable]))
return Overview(chs, sorted(blank, key=lambda c: c.repo.path.lower()))
return Overview(chs, sorted(blank, key=lambda c: c.repo.path.lower()),
sorted(excluded, key=lambda c: c.repo.path.lower()),
sorted(undecided, key=lambda c: c.repo.path.lower()),
sorted((set(sel.states) | set(sel.skip_checks)) - seen))
def icons(chs: list) -> str: