Skip to content
Open
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
1 change: 1 addition & 0 deletions .github/workflows/grade-assignment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
jobs:
grade:
permissions:
contents: read
issues: write
pull-requests: write
uses: HackYourFuture/github-actions/.github/workflows/auto-grade.yml@main
21 changes: 14 additions & 7 deletions .hyf/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,21 @@ fi
((score += l1))
pass "Level 1: required files ($l1/10 pts)"

# Helper: returns true when a file is non-empty and all TODO placeholders have
# been removed. The assignment instruction is "replace every TODO" — any
# remaining occurrence of the word TODO (case-insensitive) means the file is
# still a scaffold stub.
# Helper: returns true when a file has real content and no *unreplaced* TODO
# placeholder remains. A completed query left below the scaffold's "-- TODO:"
# guide comment still counts as filled: SQL line-comments are stripped before
# the check, and only a line whose content *begins* with TODO (an unreplaced
# markdown placeholder) marks the file a stub. The instruction line
# "...Replace every TODO." (TODO not at line start) is fine.
file_is_filled() {
local f="$1"
[[ -s "$f" ]] || return 1
grep -qiE "\bTODO\b" "$f" && return 1
local body
body="$(sed -E 's/--.*$//' "$f" | grep -vE '^[[:space:]]*$')"
[[ -n "$body" ]] || return 1
if printf '%s\n' "$body" | grep -qiE '^[[:space:]]*([#>*-]+[[:space:]]*)?TODO\b'; then
return 1
fi
return 0
}

Expand Down Expand Up @@ -105,14 +112,14 @@ if file_is_filled "$ss"; then
((l3 += 4)); pass "schema_setup.sql: file filled (no stub TODOs)"

# 3a: creates vw_dim_zones
if grep -qiE "VIEW[[:space:]]+vw_dim_zones" "$ss"; then
if grep -qiE "VIEW[[:space:]]+([a-zA-Z_][a-zA-Z0-9_]*\.)?vw_dim_zones\b" "$ss"; then
((l3 += 5)); pass "schema_setup.sql: vw_dim_zones view defined"
else
fail "schema_setup.sql: vw_dim_zones view not found — check spelling (Task 2)"
fi

# 3b: creates vw_fact_trips
if grep -qiE "VIEW[[:space:]]+vw_fact_trips" "$ss"; then
if grep -qiE "VIEW[[:space:]]+([a-zA-Z_][a-zA-Z0-9_]*\.)?vw_fact_trips\b" "$ss"; then
((l3 += 5)); pass "schema_setup.sql: vw_fact_trips view defined"
else
fail "schema_setup.sql: vw_fact_trips view not found — check spelling (Task 2)"
Expand Down