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
16 changes: 16 additions & 0 deletions common-theme/layouts/_default/backlog.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
{{ $recurringTasks := slice }}
{{ $mandatoryTasks := slice }}
{{ $optionalTasks := slice }}
{{ $moduleTasks := slice }}

{{ $partial := "block/issues-list-as-blocks-github.html"}}

Expand All @@ -52,6 +53,8 @@
{{ $mandatoryTasks = $mandatoryTasks | append $issue }}
{{else if in .name "Optional"}}
{{ $optionalTasks = $optionalTasks | append $issue }}
{{else if in .name "Module"}}
{{ $moduleTasks = $moduleTasks | append $issue }}
{{ end }}
{{ end }}
{{ end }}
Expand All @@ -70,6 +73,19 @@ <h2>Start Here</h2>
) }}
{{ end }}
{{ end }}
{{ if lt 0 ($moduleTasks | len) }}
<h2>During this module</h2>
<p>These tasks can be completed at any point during this module. Don't leave them to the last minute!</p>
{{range $moduleTasks}}
{{ partial "block/backlog-issue.html" (dict
"block" .
"Page" $.Page
"Site" site
"sprint" $backlog_filter
"path" $currentPath
) }}
{{ end }}
{{ end }}
{{ if lt 0 ($recurringTasks | len) }}
<h2>Recurring Tasks</h2>
<p>These tasks need to be completed in every sprint.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,33 @@
{{ $moduleData := partial "slices/find-by-key.html" (dict "slice" $courseData.modules "key" "name" "target_value" $moduleName "error_template" (printf "Couldn't find module %%s in backlog data from portal for course %s" $courseName)) }}
{{ $sprintData := partial "slices/find-by-key.html" (dict "slice" $moduleData.sprints "key" "name" "target_value" $sprintName "error_template" (printf "Couldn't find sprint %%s in backlog data from portal for course %s module %s" $courseName $moduleName)) }}

{{ range $sprintData.backlog_tasks }}
{{ $github_issue_number := int (index (last 1 (split .github_html_url "/")) 0) }}
{{ $labels := dict "nodes" slice }}
{{ if eq .category "mandatory" }}
{{ $labels = dict "nodes" (slice (dict "name" "Core")) }}
{{ else if eq .category "optional" }}
{{ $labels = dict "nodes" (slice (dict "name" "Optional")) }}
{{ else if eq .category "recurring" }}
{{ $labels = dict "nodes" (slice (dict "name" "Recurring")) }}
{{ else if eq .category "setup" }}
{{ $labels = dict "nodes" (slice (dict "name" "Setup")) }}
{{/*
Right now the Portal sets whole-module tasks as an anonymous extra sprint in the sprints list.
We've asked them to set a sibling key to sprints within a module, rather than making a phantom sprint.
TODO: Update this to $moduleData.backlog_tasks when the portal sets this differently.
*/}}
{{ $moduleBacklogTasksSprint := partial "slices/find-by-key.html" (dict "slice" $moduleData.sprints "key" "name" "target_value" nil "default" (dict "backlog_tasks" slice)) }}
{{ range $type, $issues := (dict "sprint" $sprintData.backlog_tasks "module" $moduleBacklogTasksSprint.backlog_tasks) }}
{{ range $issue := $issues }}
{{ $github_issue_number := int (index (last 1 (split $issue.github_html_url "/")) 0) }}
{{ $labels := dict "nodes" slice }}
{{ if eq $type "module" }}
{{ $labels = dict "nodes" (slice (dict "name" "Module")) }}
{{ else if eq $issue.category "mandatory" }}
{{ $labels = dict "nodes" (slice (dict "name" "Core")) }}
{{ else if eq $issue.category "optional" }}
{{ $labels = dict "nodes" (slice (dict "name" "Optional")) }}
{{ else if eq $issue.category "recurring" }}
{{ $labels = dict "nodes" (slice (dict "name" "Recurring")) }}
{{ else if eq $issue.category "setup" }}
{{ $labels = dict "nodes" (slice (dict "name" "Setup")) }}
{{ end }}
{{ $time := $issue.time_hours }}
{{ if $time }}
{{ $time = mul $time 60 }}
{{ end }}
{{ $issueBlocks = $issueBlocks | append (dict "name" $issue.title "src" (printf "portal-issue://%s" $issue.github_html_url) "number" $github_issue_number "labels" $labels "repo" $repoName "body" $issue.body "learning_objectives" $issue.learning_outcomes "time" $time "code" $issue.code "submit" $issue.submit "Page" $page) }}
{{ end }}
{{ $time := .time_hours }}
{{ if $time }}
{{ $time = mul $time 60 }}
{{ end }}
{{ $issueBlocks = $issueBlocks | append (dict "name" .title "src" (printf "portal-issue://%s" .github_html_url) "number" $github_issue_number "labels" $labels "repo" $repoName "body" .body "learning_objectives" .learning_outcomes "time" $time "code" .code "submit" .submit "Page" $page) }}
{{ end }}
{{ end }}
{{ end }}
Expand Down
9 changes: 8 additions & 1 deletion common-theme/layouts/partials/slices/find-by-key.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{{ $slice := .slice }}
{{ $key := .key }}
{{ $target_value := .target_value }}

{{/* Exactly one of error_template or default should be set */}}
{{ $error_template := .error_template }}
{{ $hasDefault := isset . "default" }}
{{ $default := .default }}

{{ $found := "PLACEHOLDER_NOT_FOUND_BECAUSE_HUGO_DOES_NOT_ALLOW_NIL" }}

Expand All @@ -13,7 +17,10 @@
{{ end }}

{{ if eq $found "PLACEHOLDER_NOT_FOUND_BECAUSE_HUGO_DOES_NOT_ALLOW_NIL" }}
{{ errorf $error_template $target_value }}
{{ $found = $default }}
{{ if not $hasDefault }}
{{ errorf $error_template $target_value }}
{{ end }}
{{ end }}

{{/*
Expand Down
Loading