Skip to content

Commit 94be30c

Browse files
authored
Emit learning KPI rubric scores from curriculum assessment output (#1232)
1 parent 4c70511 commit 94be30c

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

‎.github/skills/curriculum-quantitative-assessment/curriculum_assessment.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def overall_score_from_metrics(metrics: dict) -> tuple[dict, float]:
207207
def score_markdown(raw: str, filename: str, *, title: str | None = None) -> dict:
208208
metrics = collect_metrics_from_text(raw, filename, title=title)
209209
dim_scores, overall_score = overall_score_from_metrics(metrics)
210-
return {**metrics, "dim_scores": dim_scores, "overall_score": overall_score}
210+
return {**metrics, **dim_scores, "dim_scores": dim_scores, "overall_score": overall_score}
211211

212212

213213
def score_workshop_file(path: str | pathlib.Path) -> dict:
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
from __future__ import annotations
2+
3+
import unittest
4+
5+
from curriculum_assessment import DIMENSIONS, score_markdown
6+
7+
8+
SAMPLE_MARKDOWN = """# Example Step
9+
10+
## 📋 Before You Start
11+
12+
- Install the CLI.
13+
14+
## Try it
15+
16+
Run `gh aw compile`.
17+
18+
```bash
19+
gh aw compile
20+
```
21+
22+
## ✅ Checkpoint
23+
24+
- [ ] You ran the command
25+
- [ ] You verified the output
26+
"""
27+
28+
29+
class ScoreMarkdownTests(unittest.TestCase):
30+
def test_dimension_scores_are_emitted_at_top_level(self) -> None:
31+
scored = score_markdown(SAMPLE_MARKDOWN, "example.md")
32+
33+
for dimension in DIMENSIONS:
34+
self.assertIn(dimension, scored)
35+
self.assertEqual(scored[dimension], scored["dim_scores"][dimension])
36+
37+
weighted_sum = sum(scored["dim_scores"][dimension] * weight for dimension, weight in DIMENSIONS.items())
38+
expected_overall = round(weighted_sum / sum(DIMENSIONS.values()), 2)
39+
self.assertEqual(scored["overall_score"], expected_overall)
40+
41+
42+
if __name__ == "__main__":
43+
unittest.main()

0 commit comments

Comments
 (0)