Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,6 @@ src/crates/scriptmark/tests/fixtures/**/.DS_Store
!examples/bundles/*/submissions/
!examples/bundles/*/submissions/**
examples/bundles/**/__pycache__/
# OSS-148: a bundle's roster, and the grade sheets it is expected to export.
!examples/bundles/*/*.csv
!examples/bundles/*/expected/*.csv
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ regex = "1"
# Archive
zip = { version = "8", default-features = false, features = ["deflate"] }

# Spreadsheets
rust_xlsxwriter = "0.99"
calamine = "0.36"

# System
libc = "0.2"

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ scriptmark grade submissions/ -t tests/ --force
# Read the latest revision, or any other with --revision N
scriptmark summarize output/results.json --revision 1
scriptmark export output/results.json -o grades.csv
# The same grades as a workbook: 学号 kept as text, scores as numbers, and sheets for the
# items, the cases behind each grade and the record and revision they came from
scriptmark export output/results.json -o grades.xlsx
scriptmark db save output/results.json --revision 1 --db grades.db

# Preview student/file/function matching; edit assignment.toml to resolve candidates
Expand Down Expand Up @@ -371,6 +374,7 @@ See [the scoring contract](https://github.com/Acture/obsidian-vault/blob/project
- **Parallel** -- tokio orchestrator, grades 80+ students in seconds
- **Parametrize + oracle** -- random inputs with teacher reference implementations
- **Per-item scoring** -- declared points and aggregation; zero and withheld kept apart in every export
- **Grade sheets** -- one row per student as CSV or XLSX from one table, naming the assignment, revision and evidence they came from
- **Canvas LMS** -- roster pull, grades push
- **Similarity detection** -- style + structural code comparison
- **TUI + HTML reports** -- interactive browser and standalone dashboards
Expand Down
28 changes: 28 additions & 0 deletions examples/bundles/grade_sheet/assignment.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# A class graded once and exported as a grade sheet, then rescored and exported again:
#
# scriptmark grade submissions -t tests -r roster.csv -o out/results.json
# scriptmark export out/results.json -o out/grades.csv
# scriptmark export out/results.json -o out/grades.xlsx
# scriptmark rescore out/results.json --assignment regrade.toml
# scriptmark export out/results.json --revision 2 -o out/grades.xlsx
#
# One row per student, in 学号 order. 0012301 is right; 0012302 earns a third of `parity`;
# 0012303 hands in wrong answers, a real 0; 0012304 hands in nothing, withheld; 0012305's
# `mean` raises; and 0012399 is on no roster, withheld until someone reviews it. Under
# regrade.toml, a missing submission is a 0, which the sheet marks `not_submitted`.
# expected/ holds both CSVs as this build writes them; the evidence column is the only
# part that differs on another machine.
[assignment]
name = "lab3 统计"

[[items]]
id = "mean"
title = "平均值"
points = 6
aggregation = "proportional"

[[items]]
id = "parity"
title = "奇偶判断"
points = 1
aggregation = "proportional"
7 changes: 7 additions & 0 deletions examples/bundles/grade_sheet/expected/grades-rescored.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
student_id,student_name,canvas_user_id,state,reason,score,max,raw_grade,final_grade,mean_score,mean_state,mean_reason,parity_score,parity_state,parity_reason,assignment,revision,evidence
0012301,张三,,graded,,7,7,100,100,6,graded,,1,graded,,lab3 统计,2,36a938ed4d85
0012302,李四,,graded,,6.3333,7,90.48,90.48,6,graded,,0.3333,graded,,lab3 统计,2,36a938ed4d85
0012303,王五,,graded,,0,7,0,0,0,graded,,0,graded,,lab3 统计,2,36a938ed4d85
0012304,赵六,,graded,not_submitted,0,7,0,0,0,graded,not_submitted,0,graded,not_submitted,lab3 统计,2,36a938ed4d85
0012305,钱七,,graded,,1,7,14.29,14.29,0,graded,,1,graded,,lab3 统计,2,36a938ed4d85
local:0012399,,,withheld,pending_review,,7,,,,,,,,,lab3 统计,2,36a938ed4d85
7 changes: 7 additions & 0 deletions examples/bundles/grade_sheet/expected/grades.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
student_id,student_name,canvas_user_id,state,reason,score,max,raw_grade,final_grade,mean_score,mean_state,mean_reason,parity_score,parity_state,parity_reason,assignment,revision,evidence
0012301,张三,,graded,,7,7,100,100,6,graded,,1,graded,,lab3 统计,1,36a938ed4d85
0012302,李四,,graded,,6.3333,7,90.48,90.48,6,graded,,0.3333,graded,,lab3 统计,1,36a938ed4d85
0012303,王五,,graded,,0,7,0,0,0,graded,,0,graded,,lab3 统计,1,36a938ed4d85
0012304,赵六,,withheld,not_submitted,,7,,,,,,,,,lab3 统计,1,36a938ed4d85
0012305,钱七,,graded,,1,7,14.29,14.29,0,graded,,1,graded,,lab3 统计,1,36a938ed4d85
local:0012399,,,withheld,pending_review,,7,,,,,,,,,lab3 统计,1,36a938ed4d85
18 changes: 18 additions & 0 deletions examples/bundles/grade_sheet/regrade.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The same items; a roster student who hands in nothing now gets 0, with its reason.
[assignment]
name = "lab3 统计"

[grading]
missing = "zero"

[[items]]
id = "mean"
title = "平均值"
points = 6
aggregation = "proportional"

[[items]]
id = "parity"
title = "奇偶判断"
points = 1
aggregation = "proportional"
6 changes: 6 additions & 0 deletions examples/bundles/grade_sheet/roster.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name,class,student_id
张三,1班,0012301
李四,1班,0012302
王五,2班,0012303
赵六,2班,0012304
钱七,2班,0012305
6 changes: 6 additions & 0 deletions examples/bundles/grade_sheet/submissions/0012301_lab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def mean(xs):
return sum(xs) / len(xs)


def is_even(n):
return n % 2 == 0
6 changes: 6 additions & 0 deletions examples/bundles/grade_sheet/submissions/0012302_lab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def mean(xs):
return sum(xs) / len(xs)


def is_even(n):
return n > 1
6 changes: 6 additions & 0 deletions examples/bundles/grade_sheet/submissions/0012303_lab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def mean(xs):
return 0


def is_even(n):
return None
6 changes: 6 additions & 0 deletions examples/bundles/grade_sheet/submissions/0012305_lab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def mean(xs):
raise ValueError("\x1b[31m没有实现\x1b[0m")


def is_even(n):
return n % 2 == 0
6 changes: 6 additions & 0 deletions examples/bundles/grade_sheet/submissions/0012399_lab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def mean(xs):
return sum(xs) / len(xs)


def is_even(n):
return n % 2 == 0
17 changes: 17 additions & 0 deletions examples/bundles/grade_sheet/tests/test_mean.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 平均值: the mean of a list.

[meta]
name = "mean"
file = "lab.py"
function = "mean"
language = "python"

[[cases]]
name = "整数"
args = [[1, 2, 3]]
expect = 2.0

[[cases]]
name = "小数"
args = [[0.5, 1.5]]
expect = 1.0
22 changes: 22 additions & 0 deletions examples/bundles/grade_sheet/tests/test_parity.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 奇偶判断: three cases on one point, so passing one is a third of a point.

[meta]
name = "parity"
file = "lab.py"
function = "is_even"
language = "python"

[[cases]]
name = "二"
args = [2]
expect = true

[[cases]]
name = "三"
args = [3]
expect = false

[[cases]]
name = "零"
args = [0]
expect = true
2 changes: 1 addition & 1 deletion notes
Submodule notes updated from 31e250 to 08d9bb
2 changes: 2 additions & 0 deletions src/crates/scriptmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ thiserror = { workspace = true }
anyhow = { workspace = true }
regex = { workspace = true }
zip = { workspace = true }
rust_xlsxwriter = { workspace = true }
libc = { workspace = true }
rand = { workspace = true }
rand_chacha = { workspace = true }
Expand All @@ -47,4 +48,5 @@ tempfile = "3"
sha2 = "0.10"

[dev-dependencies]
calamine = { workspace = true }
wiremock = "0.6.5"
Loading
Loading