Skip to content

Commit 085ac82

Browse files
authored
Merge pull request #128 from layer5io/fix-and-enhance-test-states
Fix and enhance test states
2 parents 8debeed + ac47ef6 commit 085ac82

File tree

3 files changed

+447
-172
lines changed

3 files changed

+447
-172
lines changed

layouts/partials/test/single.html

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{{- $p := .Params -}}
2+
{{- $prerequisites := partial "test/collect-prerequisites.html" . -}}
3+
{{- $ctx := partial "resolve-tenant.html" . -}}
4+
{{- $orgId := $ctx.uuid -}}
5+
6+
{{- $total := 0 -}}
7+
{{- range $p.questions }}
8+
{{- $total = add $total (or .marks 0) }}
9+
{{- end }}
10+
11+
{{- $parent := (cond (ne .Parent nil) (dict
12+
"id" (partial "id.html" .Parent)
13+
"title" .Parent.Title
14+
"relPermalink" .Parent.RelPermalink
15+
"type" .Parent.Type
16+
) nil) -}}
17+
18+
{{- return (dict
19+
"id" (partial "id.html" .)
20+
"title" .Title
21+
"org_id" $orgId
22+
"final" (partial "test/is-final.html" .)
23+
"description" (.Content | safeHTML)
24+
"slug" .Slug
25+
"relPermalink" .RelPermalink
26+
"permalink" .Permalink
27+
"type" .Type
28+
"section" .Section
29+
"layout" .Layout
30+
"date" (.Date | time.Format "2006-01-02")
31+
"lastmod" (.Lastmod | time.Format "2006-01-02")
32+
"draft" .Draft
33+
"file_path" .File.Path
34+
"pass_percentage" (or $p.pass_percentage 70)
35+
"time_limit" (or $p.time_limit "infinite")
36+
"questions" $p.questions
37+
"total_questions" (len $p.questions)
38+
"prerequisites" $prerequisites
39+
"total_marks" $total
40+
"parent" $parent
41+
) -}}

0 commit comments

Comments
 (0)