all progress mapped out
This commit is contained in:
parent
56394e55aa
commit
41c18cdd32
3 changed files with 64 additions and 10 deletions
21
Makefile
21
Makefile
|
@ -1,4 +1,5 @@
|
||||||
GENDIR := html/src/generated
|
GENDIR := html/src/generated
|
||||||
|
AGDA_SOURCES := $(shell find src -not \( -path src/Misc -prune \) \( -name "*.agda" -o -name "*.lagda.md" \) )
|
||||||
|
|
||||||
build-to-html:
|
build-to-html:
|
||||||
nu scripts/build-table
|
nu scripts/build-table
|
||||||
|
@ -15,23 +16,29 @@ build-to-html:
|
||||||
|| true
|
|| true
|
||||||
fd --no-ignore "html$$" $(GENDIR) -x rm
|
fd --no-ignore "html$$" $(GENDIR) -x rm
|
||||||
|
|
||||||
build-book: build-to-html
|
.PHONY: html/src/generated/Progress.md
|
||||||
mdbook build html
|
|
||||||
|
html/src/generated/Progress.md:
|
||||||
|
nu scripts/build-table > /dev/null
|
||||||
|
|
||||||
|
html/book/Progress.html: html/src/generated/Progress.md
|
||||||
pandoc \
|
pandoc \
|
||||||
-f markdown-markdown_in_html_blocks+raw_html \
|
-f markdown-markdown_in_html_blocks+raw_html \
|
||||||
-t html \
|
-t html \
|
||||||
-i html/src/generated/Progress.md \
|
-i html/src/generated/Progress.md \
|
||||||
> html/book/Progress.html
|
> html/book/Progress.html
|
||||||
|
|
||||||
|
html/book/progress/index.html: html/book/Progress.html
|
||||||
|
cat html/ProgressHeader.html $^ > $@
|
||||||
|
|
||||||
|
build-book: build-to-html
|
||||||
|
mdbook build html
|
||||||
mkdir -p html/book/progress
|
mkdir -p html/book/progress
|
||||||
cat \
|
|
||||||
html/ProgressHeader.html \
|
|
||||||
html/book/Progress.html \
|
|
||||||
> html/book/progress/index.html
|
|
||||||
|
|
||||||
refresh-book: build-to-html
|
refresh-book: build-to-html
|
||||||
mdbook serve html
|
mdbook serve html
|
||||||
|
|
||||||
deploy: build-book
|
deploy: build-book html/book/Progress.html
|
||||||
rsync -azr html/book/ root@veil:/home/blogDeploy/public/research
|
rsync -azr html/book/ root@veil:/home/blogDeploy/public/research
|
||||||
|
|
||||||
.PHONY: build-book build-to-html deploy
|
.PHONY: build-book build-to-html deploy
|
||||||
|
|
|
@ -11,9 +11,14 @@
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
src: url(https://mzhang.io/fonts/Inter-Bold.ttf) format(truetype);
|
src: url(https://mzhang.io/fonts/Inter-Bold.ttf) format(truetype);
|
||||||
}
|
}
|
||||||
|
|
||||||
body { font-family: "Inter", sans-serif; }
|
body { font-family: "Inter", sans-serif; }
|
||||||
|
h3 { margin: 0; }
|
||||||
|
table { border-spacing: 0; }
|
||||||
|
|
||||||
.cell {
|
.cell {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
min-height: 48px;
|
min-height: 48px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
|
@ -4,6 +4,9 @@ let chapters = {
|
||||||
2: 7,
|
2: 7,
|
||||||
3: 9,
|
3: 9,
|
||||||
4: 19,
|
4: 19,
|
||||||
|
6: 15,
|
||||||
|
7: 21,
|
||||||
|
8: 22,
|
||||||
}
|
}
|
||||||
|
|
||||||
let gradients = [
|
let gradients = [
|
||||||
|
@ -43,22 +46,55 @@ let viz = { |k, n|
|
||||||
# $n | math round --precision 1
|
# $n | math round --precision 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let vizCh = { |n, table|
|
||||||
|
let noExercises = $table | where type != "Exercise"
|
||||||
|
let completed = $noExercises | where completed == "x" | length
|
||||||
|
let total = $noExercises | where type != "Exercise" | length
|
||||||
|
let ratio = if $total != 0 { $completed / $total } else { 0 }
|
||||||
|
let percent = ($ratio * 100 | math round --precision 1)
|
||||||
|
let color = if $n == 0 { "gray" } else { do $interpColor $ratio }
|
||||||
|
let textColor = if $completed == $total { "gold" } else { "white" }
|
||||||
|
|
||||||
|
$"<div data-ch=\"($n)\" class=\"cell\" style=\"
|
||||||
|
background-color: ($color);
|
||||||
|
color: ($textColor);
|
||||||
|
\">
|
||||||
|
<h3>($n)</h3>
|
||||||
|
<small>($completed) / ($total)</small>
|
||||||
|
<small style=\"font-size: 0.5rem;\">($percent)%</small>
|
||||||
|
</div>" | str replace -a "\n" ""
|
||||||
|
}
|
||||||
|
|
||||||
let vizChapter = { |n|
|
let vizChapter = { |n|
|
||||||
let nStr = $n | into string
|
let nStr = $n | into string
|
||||||
let url = $"https://git.mzhang.io/api/v1/repos/school/type-theory/issues/($chapters | get $nStr)"
|
let url = $"https://git.mzhang.io/api/v1/repos/school/type-theory/issues/($chapters | get $nStr)"
|
||||||
|
|
||||||
curl -s $url
|
let table = curl -s $url
|
||||||
| jq -r .body
|
| jq -r .body
|
||||||
| lines
|
| lines
|
||||||
| rg -o $"\\[\(x| \)\\] \(.*\) \(\\d+\(\\.\\d+\)*\)" -r "$1,$2,$3"
|
| rg -o $"\\[\(x| \)\\] \(.*\) \(\\d+\(\\.\\d+\)*\)" -r "$1,$2,$3"
|
||||||
| from csv --noheaders
|
| from csv --noheaders
|
||||||
| rename completed type number
|
| rename completed type number
|
||||||
| insert section { if $in.type == "Exercise" { "Exercise" } else { $in.number | split row "." | get 1 } }
|
| insert section { if $in.type == "Exercise" { "Exercise" } else { $in.number | split row "." | get 1 } }
|
||||||
|
|
||||||
|
let table2 = $table
|
||||||
| group-by section
|
| group-by section
|
||||||
| transpose
|
| transpose
|
||||||
| each { $in | update column1 { do $viz ($in | where completed == "x" | length) ($in | length) } }
|
| each { $in | update column1 { do $viz ($in | where completed == "x" | length) ($in | length) } }
|
||||||
| sort-by -n column0
|
| sort-by -n column0
|
||||||
| prepend { column0: "Ch", column1: $n }
|
|
||||||
|
print ($table2 | table)
|
||||||
|
|
||||||
|
let newColumn1 = { column0: "Ch", column1: (do $vizCh $n $table) }
|
||||||
|
let newColumn2 = { column0: "Chnum", column1: $n }
|
||||||
|
|
||||||
|
let table3 = if ($table2 | is-empty) {
|
||||||
|
[$newColumn1, $newColumn2]
|
||||||
|
} else {
|
||||||
|
$table2 | prepend $newColumn1 | prepend $newColumn2
|
||||||
|
}
|
||||||
|
|
||||||
|
$table3
|
||||||
| transpose -r
|
| transpose -r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +102,13 @@ $chapters
|
||||||
| columns
|
| columns
|
||||||
| each { do $vizChapter $in }
|
| each { do $vizChapter $in }
|
||||||
| reduce {|it, acc| $acc | append $it }
|
| reduce {|it, acc| $acc | append $it }
|
||||||
| sort-by Ch
|
| sort-by Chnum
|
||||||
|
| reject Chnum
|
||||||
|
| transpose
|
||||||
|
| sort-by -n column0
|
||||||
|
| transpose -r
|
||||||
|
| move Ch --before 0
|
||||||
|
| to md
|
||||||
| tee { save -f html/src/generated/Progress.md }
|
| tee { save -f html/src/generated/Progress.md }
|
||||||
|
|
||||||
# open breakdown.json
|
# open breakdown.json
|
||||||
|
|
Loading…
Reference in a new issue